Пример #1
0
 /// <summary>
 /// Initializes a new instance of the ClusterUpgradeProgressObject class.
 /// </summary>
 /// <param name="codeVersion">The ServiceFabric code version of the cluster.</param>
 /// <param name="configVersion">The cluster configuration version (specified in the cluster manifest).</param>
 /// <param name="upgradeDomains">List of upgrade domains and their statuses.</param>
 /// <param name="upgradeState">The state of the upgrade domain. Possible values include: 'Invalid',
 /// 'RollingBackInProgress', 'RollingBackCompleted', 'RollingForwardPending', 'RollingForwardInProgress',
 /// 'RollingForwardCompleted', 'Failed'</param>
 /// <param name="nextUpgradeDomain">The name of the next upgrade domain to be processed.</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="upgradeDescription">Represents a ServiceFabric cluster upgrade</param>
 /// <param name="upgradeDurationInMilliseconds">The estimated elapsed time spent processing the current overall
 /// upgrade.</param>
 /// <param name="upgradeDomainDurationInMilliseconds">The estimated elapsed time spent processing the current upgrade
 /// domain.</param>
 /// <param name="unhealthyEvaluations">List of health evaluations that resulted in the current aggregated health
 /// state.</param>
 /// <param name="currentUpgradeDomainProgress">Information about the current in-progress upgrade domain.</param>
 /// <param name="startTimestampUtc">The start time of the upgrade in UTC.</param>
 /// <param name="failureTimestampUtc">The failure time of the upgrade in UTC.</param>
 /// <param name="failureReason">The cause of an upgrade failure that resulted in FailureAction being executed. Possible
 /// values include: 'None', 'Interrupted', 'HealthCheck', 'UpgradeDomainTimeout', 'OverallUpgradeTimeout'</param>
 /// <param name="upgradeDomainProgressAtFailure">The detailed upgrade progress for nodes in the current upgrade domain
 /// at the point of failure.</param>
 public ClusterUpgradeProgressObject(
     string codeVersion   = default(string),
     string configVersion = default(string),
     IEnumerable <UpgradeDomainInfo> upgradeDomains = default(IEnumerable <UpgradeDomainInfo>),
     UpgradeState?upgradeState      = default(UpgradeState?),
     string nextUpgradeDomain       = default(string),
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     ClusterUpgradeDescriptionObject upgradeDescription = default(ClusterUpgradeDescriptionObject),
     string upgradeDurationInMilliseconds       = default(string),
     string upgradeDomainDurationInMilliseconds = default(string),
     IEnumerable <HealthEvaluationWrapper> unhealthyEvaluations    = default(IEnumerable <HealthEvaluationWrapper>),
     CurrentUpgradeDomainProgressInfo currentUpgradeDomainProgress = default(CurrentUpgradeDomainProgressInfo),
     string startTimestampUtc    = default(string),
     string failureTimestampUtc  = default(string),
     FailureReason?failureReason = default(FailureReason?),
     FailedUpgradeDomainProgressObject upgradeDomainProgressAtFailure = default(FailedUpgradeDomainProgressObject))
 {
     this.CodeVersion                         = codeVersion;
     this.ConfigVersion                       = configVersion;
     this.UpgradeDomains                      = upgradeDomains;
     this.UpgradeState                        = upgradeState;
     this.NextUpgradeDomain                   = nextUpgradeDomain;
     this.RollingUpgradeMode                  = rollingUpgradeMode;
     this.UpgradeDescription                  = upgradeDescription;
     this.UpgradeDurationInMilliseconds       = upgradeDurationInMilliseconds;
     this.UpgradeDomainDurationInMilliseconds = upgradeDomainDurationInMilliseconds;
     this.UnhealthyEvaluations                = unhealthyEvaluations;
     this.CurrentUpgradeDomainProgress        = currentUpgradeDomainProgress;
     this.StartTimestampUtc                   = startTimestampUtc;
     this.FailureTimestampUtc                 = failureTimestampUtc;
     this.FailureReason                       = failureReason;
     this.UpgradeDomainProgressAtFailure      = upgradeDomainProgressAtFailure;
 }
 /// <summary>
 /// Initializes a new instance of the ApplicationUpgradeDescription class.
 /// </summary>
 /// <param name="name">The name of the target application, including the 'fabric:' URI scheme.</param>
 /// <param name="targetApplicationTypeVersion">The target application type version (found in the application manifest)
 /// for the application upgrade.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="parameters">List of application parameters with overridden values from their default values specified
 /// in the application manifest.</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, Monitored, and UnmonitoredDeferred. Possible values include: 'Invalid',
 /// 'UnmonitoredAuto', 'UnmonitoredManual', 'Monitored', 'UnmonitoredDeferred'</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="sortOrder">Defines the order in which an upgrade proceeds through the cluster. Possible values
 /// include: 'Invalid', 'Default', 'Numeric', 'Lexicographical', 'ReverseNumeric', 'ReverseLexicographical'</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="applicationHealthPolicy">Defines a health policy used to evaluate the health of an application or one
 /// of its children entities.
 /// </param>
 /// <param name="instanceCloseDelayDurationInSeconds">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, only for those instances which have a non-zero delay duration configured in the service description. See
 /// InstanceCloseDelayDurationSeconds property in $ref: "#/definitions/StatelessServiceDescription.yaml" for details.
 /// Note, the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates that the behavior
 /// will entirely depend on the delay configured in the stateless service description.
 /// </param>
 /// <param name="managedApplicationIdentity">Managed application identity description.</param>
 public ApplicationUpgradeDescription(
     string name,
     string targetApplicationTypeVersion,
     UpgradeKind?upgradeKind = Common.UpgradeKind.Rolling,
     IReadOnlyDictionary <string, string> parameters = default(IReadOnlyDictionary <string, string>),
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     long?upgradeReplicaSetCheckTimeoutInSeconds = default(long?),
     bool?forceRestart          = default(bool?),
     UpgradeSortOrder?sortOrder = Common.UpgradeSortOrder.Default,
     MonitoringPolicyDescription monitoringPolicy    = default(MonitoringPolicyDescription),
     ApplicationHealthPolicy applicationHealthPolicy = default(ApplicationHealthPolicy),
     long?instanceCloseDelayDurationInSeconds        = default(long?),
     ManagedApplicationIdentityDescription managedApplicationIdentity = default(ManagedApplicationIdentityDescription))
 {
     name.ThrowIfNull(nameof(name));
     targetApplicationTypeVersion.ThrowIfNull(nameof(targetApplicationTypeVersion));
     upgradeKind.ThrowIfNull(nameof(upgradeKind));
     this.Name = name;
     this.TargetApplicationTypeVersion = targetApplicationTypeVersion;
     this.UpgradeKind        = upgradeKind;
     this.Parameters         = parameters;
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.ForceRestart                        = forceRestart;
     this.SortOrder                           = sortOrder;
     this.MonitoringPolicy                    = monitoringPolicy;
     this.ApplicationHealthPolicy             = applicationHealthPolicy;
     this.InstanceCloseDelayDurationInSeconds = instanceCloseDelayDurationInSeconds;
     this.ManagedApplicationIdentity          = managedApplicationIdentity;
 }
 /// <summary>
 /// Initializes a new instance of the ClusterUpgradeDescriptionObject class.
 /// </summary>
 /// <param name="configVersion">The cluster configuration version (specified in the cluster manifest).</param>
 /// <param name="codeVersion">The ServiceFabric code version of the cluster.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="enableDeltaHealthEvaluation">When true, enables delta health evaluation rather than absolute health
 /// evaluation after completion of each upgrade domain.</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="clusterHealthPolicy">Defines a health policy used to evaluate the health of the cluster or of a
 /// cluster node.
 /// </param>
 /// <param name="clusterUpgradeHealthPolicy">Defines a health policy used to evaluate the health of the cluster during
 /// a cluster upgrade.</param>
 /// <param name="applicationHealthPolicyMap">Defines a map that contains specific application health policies for
 /// different applications.
 /// Each entry specifies as key the application name and as value an ApplicationHealthPolicy used to evaluate the
 /// application health.
 /// If an application is not specified in the map, the application health evaluation uses the ApplicationHealthPolicy
 /// found in its application manifest or the default application health policy (if no health policy is defined in the
 /// manifest).
 /// The map is empty by default.
 /// </param>
 public ClusterUpgradeDescriptionObject(
     string configVersion           = default(string),
     string codeVersion             = default(string),
     UpgradeKind?upgradeKind        = Common.UpgradeKind.Rolling,
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     long?upgradeReplicaSetCheckTimeoutInSeconds = default(long?),
     bool?forceRestart = default(bool?),
     bool?enableDeltaHealthEvaluation             = default(bool?),
     MonitoringPolicyDescription monitoringPolicy = default(MonitoringPolicyDescription),
     ClusterHealthPolicy clusterHealthPolicy      = default(ClusterHealthPolicy),
     ClusterUpgradeHealthPolicyObject clusterUpgradeHealthPolicy             = default(ClusterUpgradeHealthPolicyObject),
     IEnumerable <ApplicationHealthPolicyMapItem> applicationHealthPolicyMap = default(IEnumerable <ApplicationHealthPolicyMapItem>))
 {
     this.ConfigVersion      = configVersion;
     this.CodeVersion        = codeVersion;
     this.UpgradeKind        = upgradeKind;
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.ForceRestart = forceRestart;
     this.EnableDeltaHealthEvaluation = enableDeltaHealthEvaluation;
     this.MonitoringPolicy            = monitoringPolicy;
     this.ClusterHealthPolicy         = clusterHealthPolicy;
     this.ClusterUpgradeHealthPolicy  = clusterUpgradeHealthPolicy;
     this.ApplicationHealthPolicyMap  = applicationHealthPolicyMap;
 }
 /// <summary>
 /// Initializes a new instance of the StartClusterUpgradeDescription class.
 /// </summary>
 /// <param name="codeVersion">The cluster code version.</param>
 /// <param name="configVersion">The cluster configuration version.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="sortOrder">Defines the order in which an upgrade proceeds through the cluster. Possible values
 /// include: 'Invalid', 'Default', 'Numeric', 'Lexicographical', 'ReverseNumeric', 'ReverseLexicographical'</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="clusterHealthPolicy">Defines a health policy used to evaluate the health of the cluster or of a
 /// cluster node.
 /// </param>
 /// <param name="enableDeltaHealthEvaluation">When true, enables delta health evaluation rather than absolute health
 /// evaluation after completion of each upgrade domain.</param>
 /// <param name="clusterUpgradeHealthPolicy">Defines a health policy used to evaluate the health of the cluster during
 /// a cluster upgrade.</param>
 /// <param name="applicationHealthPolicyMap">Defines the application health policy map used to evaluate the health of
 /// an application or one of its children entities.
 /// </param>
 /// <param name="instanceCloseDelayDurationInSeconds">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, only for those instances which have a non-zero delay duration configured in the service description. See
 /// InstanceCloseDelayDurationSeconds property in $ref: "#/definitions/StatelessServiceDescription.yaml" for details.
 /// Note, the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates that the behavior
 /// will entirely depend on the delay configured in the stateless service description.
 /// </param>
 public StartClusterUpgradeDescription(
     string codeVersion             = default(string),
     string configVersion           = default(string),
     UpgradeKind?upgradeKind        = Common.UpgradeKind.Rolling,
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     long?upgradeReplicaSetCheckTimeoutInSeconds = default(long?),
     bool?forceRestart          = default(bool?),
     UpgradeSortOrder?sortOrder = Common.UpgradeSortOrder.Default,
     MonitoringPolicyDescription monitoringPolicy = default(MonitoringPolicyDescription),
     ClusterHealthPolicy clusterHealthPolicy      = default(ClusterHealthPolicy),
     bool?enableDeltaHealthEvaluation             = default(bool?),
     ClusterUpgradeHealthPolicyObject clusterUpgradeHealthPolicy = default(ClusterUpgradeHealthPolicyObject),
     ApplicationHealthPolicies applicationHealthPolicyMap        = default(ApplicationHealthPolicies),
     long?instanceCloseDelayDurationInSeconds = default(long?))
 {
     this.CodeVersion        = codeVersion;
     this.ConfigVersion      = configVersion;
     this.UpgradeKind        = upgradeKind;
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.ForceRestart                        = forceRestart;
     this.SortOrder                           = sortOrder;
     this.MonitoringPolicy                    = monitoringPolicy;
     this.ClusterHealthPolicy                 = clusterHealthPolicy;
     this.EnableDeltaHealthEvaluation         = enableDeltaHealthEvaluation;
     this.ClusterUpgradeHealthPolicy          = clusterUpgradeHealthPolicy;
     this.ApplicationHealthPolicyMap          = applicationHealthPolicyMap;
     this.InstanceCloseDelayDurationInSeconds = instanceCloseDelayDurationInSeconds;
 }
        /// <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, UpgradeMode?value)
        {
            switch (value)
            {
            case UpgradeMode.Invalid:
                writer.WriteStringValue("Invalid");
                break;

            case UpgradeMode.UnmonitoredAuto:
                writer.WriteStringValue("UnmonitoredAuto");
                break;

            case UpgradeMode.UnmonitoredManual:
                writer.WriteStringValue("UnmonitoredManual");
                break;

            case UpgradeMode.Monitored:
                writer.WriteStringValue("Monitored");
                break;

            case UpgradeMode.UnmonitoredDeferred:
                writer.WriteStringValue("UnmonitoredDeferred");
                break;

            default:
                throw new ArgumentException($"Invalid value {value.ToString()} for enum type UpgradeMode");
            }
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the ApplicationUpgradeDescription class.
 /// </summary>
 /// <param name="name">The name of the target application, including the 'fabric:' URI scheme.</param>
 /// <param name="targetApplicationTypeVersion">The target application type version (found in the application manifest)
 /// for the application upgrade.</param>
 /// <param name="parameters">List of application parameters with overridden values from their default values specified
 /// in the application manifest.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="applicationHealthPolicy">Defines a health policy used to evaluate the health of an application or one
 /// of its children entities.
 /// </param>
 public ApplicationUpgradeDescription(
     string name,
     string targetApplicationTypeVersion,
     IReadOnlyDictionary <string, string> parameters,
     UpgradeKind?upgradeKind        = Common.UpgradeKind.Rolling,
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     long?upgradeReplicaSetCheckTimeoutInSeconds = default(long?),
     bool?forceRestart = default(bool?),
     MonitoringPolicyDescription monitoringPolicy    = default(MonitoringPolicyDescription),
     ApplicationHealthPolicy applicationHealthPolicy = default(ApplicationHealthPolicy))
 {
     name.ThrowIfNull(nameof(name));
     targetApplicationTypeVersion.ThrowIfNull(nameof(targetApplicationTypeVersion));
     parameters.ThrowIfNull(nameof(parameters));
     upgradeKind.ThrowIfNull(nameof(upgradeKind));
     this.Name = name;
     this.TargetApplicationTypeVersion = targetApplicationTypeVersion;
     this.Parameters         = parameters;
     this.UpgradeKind        = upgradeKind;
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.ForceRestart            = forceRestart;
     this.MonitoringPolicy        = monitoringPolicy;
     this.ApplicationHealthPolicy = applicationHealthPolicy;
 }
 /// <summary>
 /// Initializes a new instance of the UpgradePolicy class.
 /// </summary>
 /// <param name="mode">Specifies the mode of an upgrade to virtual
 /// machines in the scale set.&lt;br /&gt;&lt;br /&gt; Possible values
 /// are:&lt;br /&gt;&lt;br /&gt; **Manual** - You  control the
 /// application of updates to virtual machines in the scale set. You do
 /// this by using the manualUpgrade action.&lt;br /&gt;&lt;br /&gt;
 /// **Automatic** - All virtual machines in the scale set are
 /// automatically updated at the same time. Possible values include:
 /// 'Automatic', 'Manual', 'Rolling'</param>
 /// <param name="rollingUpgradePolicy">The configuration parameters
 /// used while performing a rolling upgrade.</param>
 /// <param name="automaticOSUpgradePolicy">Configuration parameters
 /// used for performing automatic OS Upgrade.</param>
 public UpgradePolicy(UpgradeMode?mode = default(UpgradeMode?), RollingUpgradePolicy rollingUpgradePolicy = default(RollingUpgradePolicy), AutomaticOSUpgradePolicy automaticOSUpgradePolicy = default(AutomaticOSUpgradePolicy))
 {
     Mode = mode;
     RollingUpgradePolicy     = rollingUpgradePolicy;
     AutomaticOSUpgradePolicy = automaticOSUpgradePolicy;
     CustomInit();
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the GatewayResource class.
 /// </summary>
 /// <param name="id">ARM Resource ID</param>
 /// <param name="type">ARM Resource Type</param>
 /// <param name="name">ARM Resource Name</param>
 /// <param name="location">ARM Resource Location</param>
 /// <param name="tags">ARM Resource Tags</param>
 /// <param name="created">UTC date and time when gateway was first
 /// added to management service</param>
 /// <param name="updated">UTC date and time when node was last
 /// updated</param>
 /// <param name="upgradeMode">The upgradeMode property gives the
 /// flexibility to gateway to auto upgrade itself. If properties
 /// value not specified, then we assume upgradeMode = Automatic.
 /// Possible values include: 'Manual', 'Automatic'</param>
 /// <param name="desiredVersion">latest available msi version</param>
 /// <param name="instances">names of the nodes in the gateway</param>
 /// <param name="activeMessageCount">number of active messages</param>
 /// <param name="latestPublishedMsiVersion">last published msi
 /// version</param>
 /// <param name="publishedTimeUtc">the date/time of the last published
 /// gateway</param>
 /// <param name="installerDownload">installer download uri</param>
 /// <param name="minimumVersion">minimum gateway version</param>
 public GatewayResource(string id = default(string), string type = default(string), string name = default(string), string location = default(string), System.Collections.Generic.IDictionary <string, string> tags = default(System.Collections.Generic.IDictionary <string, string>), string etag = default(string), System.DateTime?created = default(System.DateTime?), System.DateTime?updated = default(System.DateTime?), UpgradeMode?upgradeMode = default(UpgradeMode?), string desiredVersion = default(string), System.Collections.Generic.IList <GatewayStatus> instances = default(System.Collections.Generic.IList <GatewayStatus>), int?activeMessageCount = default(int?), string latestPublishedMsiVersion = default(string), System.DateTime?publishedTimeUtc = default(System.DateTime?), string installerDownload = default(string), string minimumVersion = default(string))
     : base(id, type, name, location, tags, etag)
 {
     Created                   = created;
     Updated                   = updated;
     UpgradeMode               = upgradeMode;
     DesiredVersion            = desiredVersion;
     Instances                 = instances;
     ActiveMessageCount        = activeMessageCount;
     LatestPublishedMsiVersion = latestPublishedMsiVersion;
     PublishedTimeUtc          = publishedTimeUtc;
     InstallerDownload         = installerDownload;
     MinimumVersion            = minimumVersion;
 }
 /// <summary>
 /// Initializes a new instance of the ComposeDeploymentUpgradeProgressInfo class.
 /// </summary>
 /// <param name="deploymentName">The name of the target deployment.</param>
 /// <param name="applicationName">The name of the target application, including the 'fabric:' URI scheme.</param>
 /// <param name="upgradeState">The state of the compose deployment upgrade.
 /// . Possible values include: 'Invalid', 'ProvisioningTarget', 'RollingForwardInProgress', 'RollingForwardPending',
 /// 'UnprovisioningCurrent', 'RollingForwardCompleted', 'RollingBackInProgress', 'UnprovisioningTarget',
 /// 'RollingBackCompleted', 'Failed'</param>
 /// <param name="upgradeStatusDetails">Additional detailed information about the status of the pending upgrade.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="applicationHealthPolicy">Defines a health policy used to evaluate the health of an application or one
 /// of its children entities.
 /// </param>
 /// <param name="targetApplicationTypeVersion">The target application type version (found in the application manifest)
 /// for the application upgrade.</param>
 /// <param name="upgradeDuration">The estimated amount of time that the overall upgrade elapsed. It is first
 /// interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number
 /// representing the total number of milliseconds.</param>
 /// <param name="currentUpgradeDomainDuration">The estimated amount of time spent processing current Upgrade Domain. It
 /// is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a
 /// number representing the total number of milliseconds.</param>
 /// <param name="applicationUnhealthyEvaluations">List of health evaluations that resulted in the current aggregated
 /// health state.</param>
 /// <param name="currentUpgradeDomainProgress">Information about the current in-progress upgrade domain.</param>
 /// <param name="startTimestampUtc">The estimated UTC datetime when the upgrade started.</param>
 /// <param name="failureTimestampUtc">The estimated UTC datetime when the upgrade failed and FailureAction was
 /// executed.</param>
 /// <param name="failureReason">The cause of an upgrade failure that resulted in FailureAction being executed. Possible
 /// values include: 'None', 'Interrupted', 'HealthCheck', 'UpgradeDomainTimeout', 'OverallUpgradeTimeout'</param>
 /// <param name="upgradeDomainProgressAtFailure">Information about the upgrade domain progress at the time of upgrade
 /// failure.</param>
 /// <param name="applicationUpgradeStatusDetails">Additional details of application upgrade including failure
 /// message.</param>
 public ComposeDeploymentUpgradeProgressInfo(
     string deploymentName  = default(string),
     string applicationName = default(string),
     ComposeDeploymentUpgradeState?upgradeState = default(ComposeDeploymentUpgradeState?),
     string upgradeStatusDetails    = default(string),
     UpgradeKind?upgradeKind        = Common.UpgradeKind.Rolling,
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     bool?forceRestart = default(bool?),
     long?upgradeReplicaSetCheckTimeoutInSeconds     = default(long?),
     MonitoringPolicyDescription monitoringPolicy    = default(MonitoringPolicyDescription),
     ApplicationHealthPolicy applicationHealthPolicy = default(ApplicationHealthPolicy),
     string targetApplicationTypeVersion             = default(string),
     string upgradeDuration = default(string),
     string currentUpgradeDomainDuration = default(string),
     IEnumerable <HealthEvaluationWrapper> applicationUnhealthyEvaluations = default(IEnumerable <HealthEvaluationWrapper>),
     CurrentUpgradeDomainProgressInfo currentUpgradeDomainProgress         = default(CurrentUpgradeDomainProgressInfo),
     string startTimestampUtc    = default(string),
     string failureTimestampUtc  = default(string),
     FailureReason?failureReason = default(FailureReason?),
     FailureUpgradeDomainProgressInfo upgradeDomainProgressAtFailure = default(FailureUpgradeDomainProgressInfo),
     string applicationUpgradeStatusDetails = default(string))
 {
     this.DeploymentName       = deploymentName;
     this.ApplicationName      = applicationName;
     this.UpgradeState         = upgradeState;
     this.UpgradeStatusDetails = upgradeStatusDetails;
     this.UpgradeKind          = upgradeKind;
     this.RollingUpgradeMode   = rollingUpgradeMode;
     this.ForceRestart         = forceRestart;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.MonitoringPolicy             = monitoringPolicy;
     this.ApplicationHealthPolicy      = applicationHealthPolicy;
     this.TargetApplicationTypeVersion = targetApplicationTypeVersion;
     this.UpgradeDuration = upgradeDuration;
     this.CurrentUpgradeDomainDuration    = currentUpgradeDomainDuration;
     this.ApplicationUnhealthyEvaluations = applicationUnhealthyEvaluations;
     this.CurrentUpgradeDomainProgress    = currentUpgradeDomainProgress;
     this.StartTimestampUtc               = startTimestampUtc;
     this.FailureTimestampUtc             = failureTimestampUtc;
     this.FailureReason                   = failureReason;
     this.UpgradeDomainProgressAtFailure  = upgradeDomainProgressAtFailure;
     this.ApplicationUpgradeStatusDetails = applicationUpgradeStatusDetails;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the ApplicationUpgradeProgressInfo class.
 /// </summary>
 /// <param name="name">The name of the target application, including the 'fabric:' URI scheme.</param>
 /// <param name="typeName">The application type name as defined in the application manifest.</param>
 /// <param name="targetApplicationTypeVersion">The target application type version (found in the application manifest)
 /// for the application upgrade.</param>
 /// <param name="upgradeDomains">List of upgrade domains and their statuses. Not applicable to node-by-node
 /// upgrades.</param>
 /// <param name="upgradeUnits">List of upgrade units and their statuses.</param>
 /// <param name="upgradeState">The state of the upgrade domain. Possible values include: 'Invalid',
 /// 'RollingBackInProgress', 'RollingBackCompleted', 'RollingForwardPending', 'RollingForwardInProgress',
 /// 'RollingForwardCompleted', 'Failed'</param>
 /// <param name="nextUpgradeDomain">The name of the next upgrade domain to be processed. Not applicable to node-by-node
 /// upgrades.</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, Monitored, and UnmonitoredDeferred. Possible values include: 'Invalid',
 /// 'UnmonitoredAuto', 'UnmonitoredManual', 'Monitored', 'UnmonitoredDeferred'</param>
 /// <param name="upgradeDescription">Describes the parameters for an application upgrade. Note that upgrade description
 /// replaces the existing application description. This means that if the parameters are not specified, the existing
 /// parameters on the applications will be overwritten with the empty parameters list. This would result in the
 /// application using the default value of the parameters from the application manifest. If you do not want to change
 /// any existing parameter values, please get the application parameters first using the GetApplicationInfo query and
 /// then supply those values as Parameters in this ApplicationUpgradeDescription.</param>
 /// <param name="upgradeDurationInMilliseconds">The estimated total amount of time spent processing the overall
 /// upgrade.</param>
 /// <param name="upgradeDomainDurationInMilliseconds">The estimated total amount of time spent processing the current
 /// upgrade domain.</param>
 /// <param name="unhealthyEvaluations">List of health evaluations that resulted in the current aggregated health
 /// state.</param>
 /// <param name="currentUpgradeDomainProgress">Information about the current in-progress upgrade domain. Not applicable
 /// to node-by-node upgrades.</param>
 /// <param name="currentUpgradeUnitsProgress">Information about the current in-progress upgrade units.</param>
 /// <param name="startTimestampUtc">The estimated UTC datetime when the upgrade started.</param>
 /// <param name="failureTimestampUtc">The estimated UTC datetime when the upgrade failed and FailureAction was
 /// executed.</param>
 /// <param name="failureReason">The cause of an upgrade failure that resulted in FailureAction being executed. Possible
 /// values include: 'None', 'Interrupted', 'HealthCheck', 'UpgradeDomainTimeout', 'OverallUpgradeTimeout'</param>
 /// <param name="upgradeDomainProgressAtFailure">Information about the upgrade domain progress at the time of upgrade
 /// failure.</param>
 /// <param name="upgradeStatusDetails">Additional detailed information about the status of the pending upgrade.</param>
 /// <param name="isNodeByNode">Indicates whether this upgrade is node-by-node.</param>
 public ApplicationUpgradeProgressInfo(
     string name     = default(string),
     string typeName = default(string),
     string targetApplicationTypeVersion            = default(string),
     IEnumerable <UpgradeDomainInfo> upgradeDomains = default(IEnumerable <UpgradeDomainInfo>),
     IEnumerable <UpgradeUnitInfo> upgradeUnits     = default(IEnumerable <UpgradeUnitInfo>),
     UpgradeState?upgradeState      = default(UpgradeState?),
     string nextUpgradeDomain       = default(string),
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     ApplicationUpgradeDescription upgradeDescription              = default(ApplicationUpgradeDescription),
     string upgradeDurationInMilliseconds                          = default(string),
     string upgradeDomainDurationInMilliseconds                    = default(string),
     IEnumerable <HealthEvaluationWrapper> unhealthyEvaluations    = default(IEnumerable <HealthEvaluationWrapper>),
     CurrentUpgradeDomainProgressInfo currentUpgradeDomainProgress = default(CurrentUpgradeDomainProgressInfo),
     CurrentUpgradeUnitsProgressInfo currentUpgradeUnitsProgress   = default(CurrentUpgradeUnitsProgressInfo),
     string startTimestampUtc    = default(string),
     string failureTimestampUtc  = default(string),
     FailureReason?failureReason = default(FailureReason?),
     FailureUpgradeDomainProgressInfo upgradeDomainProgressAtFailure = default(FailureUpgradeDomainProgressInfo),
     string upgradeStatusDetails = default(string),
     bool?isNodeByNode           = false)
 {
     this.Name     = name;
     this.TypeName = typeName;
     this.TargetApplicationTypeVersion = targetApplicationTypeVersion;
     this.UpgradeDomains                      = upgradeDomains;
     this.UpgradeUnits                        = upgradeUnits;
     this.UpgradeState                        = upgradeState;
     this.NextUpgradeDomain                   = nextUpgradeDomain;
     this.RollingUpgradeMode                  = rollingUpgradeMode;
     this.UpgradeDescription                  = upgradeDescription;
     this.UpgradeDurationInMilliseconds       = upgradeDurationInMilliseconds;
     this.UpgradeDomainDurationInMilliseconds = upgradeDomainDurationInMilliseconds;
     this.UnhealthyEvaluations                = unhealthyEvaluations;
     this.CurrentUpgradeDomainProgress        = currentUpgradeDomainProgress;
     this.CurrentUpgradeUnitsProgress         = currentUpgradeUnitsProgress;
     this.StartTimestampUtc                   = startTimestampUtc;
     this.FailureTimestampUtc                 = failureTimestampUtc;
     this.FailureReason                       = failureReason;
     this.UpgradeDomainProgressAtFailure      = upgradeDomainProgressAtFailure;
     this.UpgradeStatusDetails                = upgradeStatusDetails;
     this.IsNodeByNode                        = isNodeByNode;
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the RollingUpgradeUpdateDescription class.
 /// </summary>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="replicaSetCheckTimeoutInMilliseconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="failureAction">The compensating action to perform when a Monitored upgrade encounters monitoring
 /// policy or health policy violations.
 /// Invalid indicates the failure action is invalid. Rollback specifies that the upgrade will start rolling back
 /// automatically.
 /// Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode.
 /// . Possible values include: 'Invalid', 'Rollback', 'Manual'</param>
 /// <param name="healthCheckWaitDurationInMilliseconds">The amount of time to wait after completing an upgrade domain
 /// before applying health policies. It is first interpreted as a string representing an ISO 8601 duration. If that
 /// fails, then it is interpreted as a number representing the total number of milliseconds.</param>
 /// <param name="healthCheckStableDurationInMilliseconds">The amount of time that the application or cluster must
 /// remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted as a string
 /// representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number
 /// of milliseconds.</param>
 /// <param name="healthCheckRetryTimeoutInMilliseconds">The amount of time to retry health evaluation when the
 /// application or cluster is unhealthy before FailureAction is executed. It is first interpreted as a string
 /// representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number
 /// of milliseconds.</param>
 /// <param name="upgradeTimeoutInMilliseconds">The amount of time the overall upgrade has to complete before
 /// FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails,
 /// then it is interpreted as a number representing the total number of milliseconds.</param>
 /// <param name="upgradeDomainTimeoutInMilliseconds">The amount of time each upgrade domain has to complete before
 /// FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails,
 /// then it is interpreted as a number representing the total number of milliseconds.</param>
 public RollingUpgradeUpdateDescription(
     UpgradeMode?rollingUpgradeMode = Common.UpgradeMode.UnmonitoredAuto,
     bool?forceRestart = default(bool?),
     long?replicaSetCheckTimeoutInMilliseconds = default(long?),
     FailureAction?failureAction = default(FailureAction?),
     string healthCheckWaitDurationInMilliseconds   = default(string),
     string healthCheckStableDurationInMilliseconds = default(string),
     string healthCheckRetryTimeoutInMilliseconds   = default(string),
     string upgradeTimeoutInMilliseconds            = default(string),
     string upgradeDomainTimeoutInMilliseconds      = default(string))
 {
     rollingUpgradeMode.ThrowIfNull(nameof(rollingUpgradeMode));
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.ForceRestart       = forceRestart;
     this.ReplicaSetCheckTimeoutInMilliseconds = replicaSetCheckTimeoutInMilliseconds;
     this.FailureAction = failureAction;
     this.HealthCheckWaitDurationInMilliseconds   = healthCheckWaitDurationInMilliseconds;
     this.HealthCheckStableDurationInMilliseconds = healthCheckStableDurationInMilliseconds;
     this.HealthCheckRetryTimeoutInMilliseconds   = healthCheckRetryTimeoutInMilliseconds;
     this.UpgradeTimeoutInMilliseconds            = upgradeTimeoutInMilliseconds;
     this.UpgradeDomainTimeoutInMilliseconds      = upgradeDomainTimeoutInMilliseconds;
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the ComposeDeploymentUpgradeDescription class.
 /// </summary>
 /// <param name="deploymentName">The name of the deployment.</param>
 /// <param name="composeFileContent">The content of the compose file that describes the deployment to create.</param>
 /// <param name="upgradeKind">The kind of upgrade out of the following possible values. Possible values include:
 /// 'Invalid', 'Rolling'</param>
 /// <param name="registryCredential">Credential information to connect to container registry.</param>
 /// <param name="rollingUpgradeMode">The mode used to monitor health during a rolling upgrade. The values are
 /// UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: 'Invalid', 'UnmonitoredAuto',
 /// 'UnmonitoredManual', 'Monitored'</param>
 /// <param name="upgradeReplicaSetCheckTimeoutInSeconds">The maximum amount of time to block processing of an upgrade
 /// domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of
 /// the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each
 /// upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).</param>
 /// <param name="forceRestart">If true, then processes are forcefully restarted during upgrade even when the code
 /// version has not changed (the upgrade only changes configuration or data).</param>
 /// <param name="monitoringPolicy">Describes the parameters for monitoring an upgrade in Monitored mode.</param>
 /// <param name="applicationHealthPolicy">Defines a health policy used to evaluate the health of an application or one
 /// of its children entities.
 /// </param>
 public ComposeDeploymentUpgradeDescription(
     string deploymentName,
     string composeFileContent,
     UpgradeKind?upgradeKind = Common.UpgradeKind.Rolling,
     RegistryCredential registryCredential       = default(RegistryCredential),
     UpgradeMode?rollingUpgradeMode              = Common.UpgradeMode.UnmonitoredAuto,
     long?upgradeReplicaSetCheckTimeoutInSeconds = default(long?),
     bool?forceRestart = default(bool?),
     MonitoringPolicyDescription monitoringPolicy    = default(MonitoringPolicyDescription),
     ApplicationHealthPolicy applicationHealthPolicy = default(ApplicationHealthPolicy))
 {
     deploymentName.ThrowIfNull(nameof(deploymentName));
     composeFileContent.ThrowIfNull(nameof(composeFileContent));
     upgradeKind.ThrowIfNull(nameof(upgradeKind));
     this.DeploymentName     = deploymentName;
     this.ComposeFileContent = composeFileContent;
     this.UpgradeKind        = upgradeKind;
     this.RegistryCredential = registryCredential;
     this.RollingUpgradeMode = rollingUpgradeMode;
     this.UpgradeReplicaSetCheckTimeoutInSeconds = upgradeReplicaSetCheckTimeoutInSeconds;
     this.ForceRestart            = forceRestart;
     this.MonitoringPolicy        = monitoringPolicy;
     this.ApplicationHealthPolicy = applicationHealthPolicy;
 }
 /// <summary>
 /// Initializes a new instance of the UpgradePolicy class.
 /// </summary>
 /// <param name="mode">Specifies the mode of an upgrade to virtual
 /// machines in the scale set.&lt;br /&gt;&lt;br /&gt; Possible values
 /// are:&lt;br /&gt;&lt;br /&gt; **Manual** - You  control the
 /// application of updates to virtual machines in the scale set. You do
 /// this by using the manualUpgrade action.&lt;br /&gt;&lt;br /&gt;
 /// **Automatic** - All virtual machines in the scale set are
 /// automatically updated at the same time. Possible values include:
 /// 'Automatic', 'Manual'</param>
 public UpgradePolicy(UpgradeMode?mode = default(UpgradeMode?))
 {
     Mode = mode;
     CustomInit();
 }
        internal static ResourceConfig <VirtualMachineScaleSet> CreateVirtualMachineScaleSetConfig(
            this ResourceConfig <ResourceGroup> resourceGroup,
            string name,
            NestedResourceConfig <Subnet, VirtualNetwork> subnet,
            IEnumerable <NestedResourceConfig <FrontendIPConfiguration, LoadBalancer> > frontendIpConfigurations,
            NestedResourceConfig <BackendAddressPool, LoadBalancer> backendAdressPool,
            IEnumerable <NestedResourceConfig <InboundNatPool, LoadBalancer> > inboundNatPools,
            Func <ImageAndOsType> getImageAndOsType,
            string adminUsername,
            string adminPassword,
            string vmSize,
            int instanceCount,
            UpgradeMode?upgradeMode)
        => Strategy.CreateResourceConfig(
            resourceGroup: resourceGroup,
            name: name,
            createModel: engine =>
        {
            var imageAndOsType = getImageAndOsType();
            return(new VirtualMachineScaleSet()
            {
                Zones = frontendIpConfigurations
                        ?.Select(f => f.CreateModel(engine))
                        ?.Where(z => z?.Zones != null)
                        .SelectMany(z => z.Zones)
                        .Where(z => z != null)
                        .ToList(),

                UpgradePolicy = new UpgradePolicy
                {
                    Mode = upgradeMode ?? UpgradeMode.Manual
                },

                Sku = new Azure.Management.Compute.Models.Sku()
                {
                    Capacity = instanceCount,
                    Name = vmSize,
                },
                VirtualMachineProfile = new VirtualMachineScaleSetVMProfile
                {
                    OsProfile = new VirtualMachineScaleSetOSProfile
                    {
                        ComputerNamePrefix = name.Substring(0, Math.Min(name.Length, 9)),
                        WindowsConfiguration = imageAndOsType.CreateWindowsConfiguration(),
                        LinuxConfiguration = imageAndOsType.CreateLinuxConfiguration(),
                        AdminUsername = adminUsername,
                        AdminPassword = adminPassword,
                    },
                    StorageProfile = new VirtualMachineScaleSetStorageProfile
                    {
                        ImageReference = imageAndOsType.Image
                    },
                    NetworkProfile = new VirtualMachineScaleSetNetworkProfile
                    {
                        NetworkInterfaceConfigurations = new[]
                        {
                            new VirtualMachineScaleSetNetworkConfiguration
                            {
                                Name = name,
                                IpConfigurations = new []
                                {
                                    new VirtualMachineScaleSetIPConfiguration
                                    {
                                        Name = name,
                                        LoadBalancerBackendAddressPools = new []
                                        {
                                            engine.GetReference(backendAdressPool)
                                        },
                                        Subnet = engine.GetReference(subnet),
                                        LoadBalancerInboundNatPools = inboundNatPools
                                                                      .Select(engine.GetReference)
                                                                      .ToList()
                                    }
                                },
                                Primary = true
                            }
                        }
                    }
                }
            });
        });
 internal static ResourceConfig <VirtualMachineScaleSet> CreateVirtualMachineScaleSetConfig(
     this ResourceConfig <ResourceGroup> resourceGroup,
     string name,
     NestedResourceConfig <Subnet, VirtualNetwork> subnet,
     NestedResourceConfig <BackendAddressPool, LoadBalancer> backendAdressPool,
     IEnumerable <NestedResourceConfig <InboundNatPool, LoadBalancer> > inboundNatPools,
     ResourceConfig <NetworkSecurityGroup> networkSecurityGroup,
     ImageAndOsType imageAndOsType,
     string adminUsername,
     string adminPassword,
     string vmSize,
     int instanceCount,
     VirtualMachineScaleSetIdentity identity,
     bool singlePlacementGroup,
     UpgradeMode?upgradeMode,
     IEnumerable <int> dataDisks,
     IList <string> zones,
     bool ultraSSDEnabled,
     Func <IEngine, SubResource> proximityPlacementGroup,
     string priority,
     string evictionPolicy,
     double?maxPrice,
     string[] scaleInPolicy,
     bool doNotRunExtensionsOnOverprovisionedVMs)
 => Strategy.CreateResourceConfig(
     resourceGroup: resourceGroup,
     name: name,
     createModel: engine => new VirtualMachineScaleSet()
 {
     Zones         = zones,
     UpgradePolicy = new UpgradePolicy
     {
         Mode = upgradeMode ?? UpgradeMode.Manual
     },
     Sku = new Azure.Management.Compute.Models.Sku()
     {
         Capacity = instanceCount,
         Name     = vmSize,
     },
     Identity               = identity,
     SinglePlacementGroup   = singlePlacementGroup,
     AdditionalCapabilities = ultraSSDEnabled ? new AdditionalCapabilities(true) : null,
     VirtualMachineProfile  = new VirtualMachineScaleSetVMProfile
     {
         OsProfile = new VirtualMachineScaleSetOSProfile
         {
             ComputerNamePrefix   = name.Substring(0, Math.Min(name.Length, 9)),
             WindowsConfiguration = imageAndOsType.CreateWindowsConfiguration(),
             LinuxConfiguration   = imageAndOsType.CreateLinuxConfiguration(),
             AdminUsername        = adminUsername,
             AdminPassword        = adminPassword,
         },
         StorageProfile = new VirtualMachineScaleSetStorageProfile
         {
             ImageReference = imageAndOsType?.Image,
             DataDisks      = DataDiskStrategy.CreateVmssDataDisks(
                 imageAndOsType?.DataDiskLuns, dataDisks)
         },
         NetworkProfile = new VirtualMachineScaleSetNetworkProfile
         {
             NetworkInterfaceConfigurations = new[]
             {
                 new VirtualMachineScaleSetNetworkConfiguration
                 {
                     Name             = name,
                     IpConfigurations = new []
                     {
                         new VirtualMachineScaleSetIPConfiguration
                         {
                             Name = name,
                             LoadBalancerBackendAddressPools = new []
                             {
                                 engine.GetReference(backendAdressPool)
                             },
                             Subnet = engine.GetReference(subnet),
                             LoadBalancerInboundNatPools = inboundNatPools
                                                           ?.Select(engine.GetReference)
                                                           .ToList()
                         }
                     },
                     Primary = true,
                     NetworkSecurityGroup = engine.GetReference(networkSecurityGroup)
                 }
             }
         },
         Priority       = priority,
         EvictionPolicy = evictionPolicy,
         BillingProfile = (maxPrice == null) ? null : new BillingProfile(maxPrice)
     },
     ProximityPlacementGroup = proximityPlacementGroup(engine),
     ScaleInPolicy           = (scaleInPolicy == null) ? null : new ScaleInPolicy
     {
         Rules = scaleInPolicy
     },
     DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null
 });
Пример #16
0
 internal UpgradePolicy(UpgradeMode?mode, RollingUpgradePolicy rollingUpgradePolicy, AutomaticOSUpgradePolicy automaticOSUpgradePolicy)
 {
     Mode = mode;
     RollingUpgradePolicy     = rollingUpgradePolicy;
     AutomaticOSUpgradePolicy = automaticOSUpgradePolicy;
 }
Пример #17
0
 /// <summary>
 /// Initializes a new instance of the GatewayParameters class.
 /// </summary>
 /// <param name="location">location of the resource</param>
 /// <param name="tags">resource tags</param>
 /// <param name="upgradeMode">The upgradeMode property gives the
 /// flexibility to gateway to auto upgrade itself. If properties
 /// value not specified, then we assume upgradeMode = Automatic.
 /// Possible values include: 'Manual', 'Automatic'</param>
 public GatewayParameters(string location = default(string), object tags = default(object), UpgradeMode?upgradeMode = default(UpgradeMode?))
 {
     Location    = location;
     Tags        = tags;
     UpgradeMode = upgradeMode;
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the UpgradePolicy class.
 /// </summary>
 public UpgradePolicy(UpgradeMode?mode = default(UpgradeMode?))
 {
     Mode = mode;
 }
 /// <summary>
 /// Creates or updates a ManagementService gateway.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name uniquely identifies the resource group within the
 /// user subscriptionId.
 /// </param>
 /// <param name='gatewayName'>
 /// The gateway name (256 characters maximum).
 /// </param>
 /// <param name='location'>
 /// location of the resource
 /// </param>
 /// <param name='tags'>
 /// resource tags
 /// </param>
 /// <param name='upgradeMode'>
 /// The upgradeMode property gives the flexibility to gateway to auto upgrade
 /// itself. If properties value not specified, then we assume upgradeMode =
 /// Automatic. Possible values include: 'Manual', 'Automatic'
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task <GatewayResource> CreateAsync(this IGatewayOperations operations, string resourceGroupName, string gatewayName, string location = default(string), object tags = default(object), UpgradeMode?upgradeMode = default(UpgradeMode?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, gatewayName, location, tags, upgradeMode, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates or updates a ManagementService gateway.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name uniquely identifies the resource group within the
 /// user subscriptionId.
 /// </param>
 /// <param name='gatewayName'>
 /// The gateway name (256 characters maximum).
 /// </param>
 /// <param name='location'>
 /// location of the resource
 /// </param>
 /// <param name='tags'>
 /// resource tags
 /// </param>
 /// <param name='upgradeMode'>
 /// The upgradeMode property gives the flexibility to gateway to auto upgrade
 /// itself. If properties value not specified, then we assume upgradeMode =
 /// Automatic. Possible values include: 'Manual', 'Automatic'
 /// </param>
 public static GatewayResource Create(this IGatewayOperations operations, string resourceGroupName, string gatewayName, string location = default(string), object tags = default(object), UpgradeMode?upgradeMode = default(UpgradeMode?))
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IGatewayOperations)s).CreateAsync(resourceGroupName, gatewayName, location, tags, upgradeMode), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 internal static ResourceConfig <VirtualMachineScaleSet> CreateVirtualMachineScaleSetConfig(
     this ResourceConfig <ResourceGroup> resourceGroup,
     string name,
     NestedResourceConfig <Subnet, VirtualNetwork> subnet,
     NestedResourceConfig <BackendAddressPool, LoadBalancer> backendAdressPool,
     IEnumerable <NestedResourceConfig <InboundNatPool, LoadBalancer> > inboundNatPools,
     ResourceConfig <NetworkSecurityGroup> networkSecurityGroup,
     ImageAndOsType imageAndOsType,
     string adminUsername,
     string adminPassword,
     string vmSize,
     int instanceCount,
     VirtualMachineScaleSetIdentity identity,
     Boolean singlePlacementGroup,
     UpgradeMode?upgradeMode,
     IEnumerable <int> dataDisks,
     IList <string> zones)
 => Strategy.CreateResourceConfig(
     resourceGroup: resourceGroup,
     name: name,
     createModel: engine => new VirtualMachineScaleSet()
 {
     Zones         = zones,
     UpgradePolicy = new UpgradePolicy
     {
         Mode = upgradeMode ?? UpgradeMode.Manual
     },
     Sku = new Azure.Management.Compute.Models.Sku()
     {
         Capacity = instanceCount,
         Name     = vmSize,
     },
     Identity              = identity,
     SinglePlacementGroup  = singlePlacementGroup,
     VirtualMachineProfile = new VirtualMachineScaleSetVMProfile
     {
         OsProfile = new VirtualMachineScaleSetOSProfile
         {
             ComputerNamePrefix   = name.Substring(0, Math.Min(name.Length, 9)),
             WindowsConfiguration = imageAndOsType.CreateWindowsConfiguration(),
             LinuxConfiguration   = imageAndOsType.CreateLinuxConfiguration(),
             AdminUsername        = adminUsername,
             AdminPassword        = adminPassword,
         },
         StorageProfile = new VirtualMachineScaleSetStorageProfile
         {
             ImageReference = imageAndOsType?.Image,
             DataDisks      = DataDiskStrategy.CreateVmssDataDisks(
                 imageAndOsType?.DataDiskLuns, dataDisks)
         },
         NetworkProfile = new VirtualMachineScaleSetNetworkProfile
         {
             NetworkInterfaceConfigurations = new[]
             {
                 new VirtualMachineScaleSetNetworkConfiguration
                 {
                     Name             = name,
                     IpConfigurations = new []
                     {
                         new VirtualMachineScaleSetIPConfiguration
                         {
                             Name = name,
                             LoadBalancerBackendAddressPools = new []
                             {
                                 engine.GetReference(backendAdressPool)
                             },
                             Subnet = engine.GetReference(subnet),
                             LoadBalancerInboundNatPools = inboundNatPools
                                                           ?.Select(engine.GetReference)
                                                           .ToList()
                         }
                     },
                     Primary = true,
                     NetworkSecurityGroup = engine.GetReference(networkSecurityGroup)
                 }
             }
         }
     }
 });
 internal static ResourceConfig <VirtualMachineScaleSet> CreateVirtualMachineScaleSetConfig(
     this ResourceConfig <ResourceGroup> resourceGroup,
     string name,
     NestedResourceConfig <Subnet, VirtualNetwork> subnet,
     NestedResourceConfig <BackendAddressPool, LoadBalancer> backendAdressPool,
     IEnumerable <NestedResourceConfig <InboundNatPool, LoadBalancer> > inboundNatPools,
     ResourceConfig <NetworkSecurityGroup> networkSecurityGroup,
     ImageAndOsType imageAndOsType,
     string adminUsername,
     string adminPassword,
     string vmSize,
     int instanceCount,
     VirtualMachineScaleSetIdentity identity,
     bool singlePlacementGroup,
     UpgradeMode?upgradeMode,
     IEnumerable <int> dataDisks,
     IList <string> zones,
     bool ultraSSDEnabled,
     Func <IEngine, CM.SubResource> proximityPlacementGroup,
     Func <IEngine, CM.SubResource> hostGroup,
     string priority,
     string evictionPolicy,
     double?maxPrice,
     string[] scaleInPolicy,
     bool doNotRunExtensionsOnOverprovisionedVMs,
     bool encryptionAtHost,
     int?platformFaultDomainCount,
     string edgeZone,
     string orchestrationMode,
     string capacityReservationId,
     string userData,
     string imageReferenceId,
     Dictionary <string, List <string> > auxAuthHeader
     )
 => Strategy.CreateResourceConfig(
     resourceGroup: resourceGroup,
     name: name,
     createModel: engine => {
     var vmss = new VirtualMachineScaleSet
     {
         Zones            = zones,
         ExtendedLocation = edgeZone == null ? null : new CM.ExtendedLocation(edgeZone, CM.ExtendedLocationTypes.EdgeZone),
         UpgradePolicy    = new UpgradePolicy
         {
             Mode = upgradeMode ?? UpgradeMode.Manual
         },
         Sku = new Azure.Management.Compute.Models.Sku()
         {
             Capacity = instanceCount,
             Name     = vmSize,
         },
         Identity                 = identity,
         SinglePlacementGroup     = singlePlacementGroup,
         AdditionalCapabilities   = ultraSSDEnabled ? new AdditionalCapabilities(true) : null,
         PlatformFaultDomainCount = platformFaultDomainCount,
         VirtualMachineProfile    = new VirtualMachineScaleSetVMProfile
         {
             SecurityProfile = (encryptionAtHost == true) ? new SecurityProfile(encryptionAtHost: encryptionAtHost) : null,
             OsProfile       = new VirtualMachineScaleSetOSProfile
             {
                 ComputerNamePrefix   = name.Substring(0, Math.Min(name.Length, 9)),
                 WindowsConfiguration = imageAndOsType.CreateWindowsConfiguration(),
                 LinuxConfiguration   = imageAndOsType.CreateLinuxConfiguration(),
                 AdminUsername        = adminUsername,
                 AdminPassword        = adminPassword,
             },
             StorageProfile = new VirtualMachineScaleSetStorageProfile
             {
                 ImageReference = (imageReferenceId == null) ? imageAndOsType?.Image : new ImageReference
                 {
                     Id = imageReferenceId
                 },
                 DataDisks = DataDiskStrategy.CreateVmssDataDisks(
                     imageAndOsType?.DataDiskLuns, dataDisks)
             },
             NetworkProfile = new VirtualMachineScaleSetNetworkProfile
             {
                 NetworkInterfaceConfigurations = new[]
                 {
                     new VirtualMachineScaleSetNetworkConfiguration
                     {
                         Name             = name,
                         IpConfigurations = new []
                         {
                             new VirtualMachineScaleSetIPConfiguration
                             {
                                 Name = name,
                                 LoadBalancerBackendAddressPools = new []
                                 {
                                     engine.GetReference(backendAdressPool)
                                 },
                                 Subnet = engine.GetReference(subnet),
                                 LoadBalancerInboundNatPools = inboundNatPools
                                                               ?.Select(engine.GetReference)
                                                               .ToList()
                             }
                         },
                         Primary = true,
                         NetworkSecurityGroup = engine.GetReference(networkSecurityGroup)
                     }
                 }
             },
             Priority            = priority,
             EvictionPolicy      = evictionPolicy,
             BillingProfile      = (maxPrice == null) ? null : new BillingProfile(maxPrice),
             CapacityReservation = (capacityReservationId == null) ? null : new CapacityReservationProfile
             {
                 CapacityReservationGroup = new Microsoft.Azure.Management.Compute.Models.SubResource(capacityReservationId)
             },
             UserData = userData
         },
         ProximityPlacementGroup = proximityPlacementGroup(engine),
         HostGroup     = hostGroup(engine),
         ScaleInPolicy = (scaleInPolicy == null) ? null : new ScaleInPolicy
         {
             Rules = scaleInPolicy
         },
         DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null,
         OrchestrationMode = orchestrationMode
     };
     if (auxAuthHeader != null)
     {
         vmss.SetAuxAuthHeader(auxAuthHeader);
     }
     return(vmss);
 });
Пример #23
0
 internal static string ToSerializedValue(this UpgradeMode?value)
 {
     return(value == null ? null : ((UpgradeMode)value).ToSerializedValue());
 }
        internal static ResourceConfig <VirtualMachineScaleSet> CreateVirtualMachineScaleSetConfig(
            this ResourceConfig <ResourceGroup> resourceGroup,
            string name,
            NestedResourceConfig <Subnet, VirtualNetwork> subnet,
            IEnumerable <NestedResourceConfig <FrontendIPConfiguration, LoadBalancer> > frontendIpConfigurations,
            NestedResourceConfig <BackendAddressPool, LoadBalancer> backendAdressPool,
            bool isWindows,
            string adminUsername,
            string adminPassword,
            Image image,
            string vmSize,
            int instanceCount,
            UpgradeMode?upgradeMode)
        => Strategy.CreateResourceConfig(
            resourceGroup: resourceGroup,
            name: name,
            createModel: subscriptionId =>
        {
            var vmss = new VirtualMachineScaleSet()
            {
                Zones = frontendIpConfigurations
                        ?.Select(f => f.CreateModel(subscriptionId))
                        ?.Where(z => z?.Zones != null)
                        .SelectMany(z => z.Zones)
                        .Where(z => z != null)
                        .ToList(),

                UpgradePolicy = upgradeMode.HasValue ?
                                new UpgradePolicy
                {
                    Mode = upgradeMode
                }
                            : new UpgradePolicy
                {
                    Mode = UpgradeMode.Manual
                },

                Sku = new Microsoft.Azure.Management.Compute.Models.Sku()
                {
                    Capacity = instanceCount,
                    Name     = vmSize,
                },
                VirtualMachineProfile = new VirtualMachineScaleSetVMProfile()
            };

            vmss.VirtualMachineProfile.OsProfile = new VirtualMachineScaleSetOSProfile
            {
                ComputerNamePrefix   = name.Substring(0, Math.Min(name.Length, 9)),
                WindowsConfiguration = isWindows ? new WindowsConfiguration {
                } : null,
                LinuxConfiguration   = isWindows ? null : new LinuxConfiguration(),
                AdminUsername        = adminUsername,
                AdminPassword        = adminPassword,
            };

            vmss.VirtualMachineProfile.StorageProfile = new VirtualMachineScaleSetStorageProfile
            {
                ImageReference = new ImageReference
                {
                    Publisher = image.publisher,
                    Offer     = image.offer,
                    Sku       = image.sku,
                    Version   = image.version
                }
            };

            var ipConfig = new VirtualMachineScaleSetIPConfiguration
            {
                Name = name,
                LoadBalancerBackendAddressPools = new List <Microsoft.Azure.Management.Compute.Models.SubResource>(
                    new[] {
                    new Microsoft.Azure.Management.Compute.Models.SubResource(
                        id: backendAdressPool.GetId(subscriptionId).IdToString())
                }),
                Subnet = new ApiEntityReference {
                    Id = subnet.GetId(subscriptionId).IdToString()
                }
            };


            vmss.VirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile
            {
                NetworkInterfaceConfigurations = new[]
                {
                    new VirtualMachineScaleSetNetworkConfiguration
                    {
                        Name             = name,
                        IpConfigurations = new List <VirtualMachineScaleSetIPConfiguration>(
                            new [] { ipConfig }),
                        Primary = true
                    }
                }
            };


            return(vmss);
        },
            dependencies: new IEntityConfig[] { subnet, backendAdressPool }
            .Concat(frontendIpConfigurations));