Example #1
0
 /// <summary>
 /// <para>Starts rolling back the current compose deployment upgrade.</para>
 /// </summary>
 /// <param name="client"><see cref="System.Fabric.FabricClient"/> object.</param>
 /// <param name="description">
 /// <para>The <see cref="Description.ComposeDeploymentRollbackDescription"/> that determines which compose deployment should be rolled back.</para>
 /// </param>
 /// <param name="timeout">
 /// <para>Defines the maximum amount of time the system will allow this operation to continue before returning System.TimeoutException.</para>
 /// </param>
 /// <returns>
 /// <para>A <see cref="System.Threading.Tasks.Task" /> representing the operation.</para>
 /// </returns>
 /// <exception cref="System.Fabric.FabricElementNotFoundException">
 /// <para>
 /// <see cref="System.Fabric.FabricErrorCode.ComposeDeploymentNotFound" />: The compose deployment does not exist.
 /// </para>
 /// </exception>
 /// <exception cref="System.Fabric.FabricException">
 /// <para>
 /// <see cref="System.Fabric.FabricErrorCode.ComposeDeploymentNotUpgrading" />: There is no pending upgrade for the specified compose deployment to rollback.
 /// </para>
 /// </exception>
 public static Task RollbackComposeDeploymentUpgradeAsync(
     this FabricClient.ComposeDeploymentClient client,
     ComposeDeploymentRollbackDescription description,
     TimeSpan timeout)
 {
     return(client.RollbackComposeDeploymentUpgradeAsync(description.ToWrapper(), timeout));
 }
        protected void RollbackComposeDeploymentUpgrade(ComposeDeploymentRollbackDescription description)
        {
            var clusterConnection = this.GetClusterConnection();

            try
            {
                clusterConnection.RollbackComposeDeploymentUpgradeAsync(
                    description,
                    this.GetTimeout(),
                    this.GetCancellationToken()).Wait();
            }
            catch (AggregateException aggregateException)
            {
                aggregateException.Handle((ae) =>
                {
                    this.ThrowTerminatingError(
                        ae,
                        Constants.RollbackComposeDeploymentUpgradeErrorId,
                        clusterConnection);
                    return(true);
                });
            }
        }