private string FormatRolloutInfoHeader(PSRollout rollout) { StringBuilder sb = new StringBuilder(); sb.InvariantAppend($"\n\nStatus: {rollout.Status}"); if (rollout.Status == RolloutCmdletBase.FailedStatus) { verboseBuilder.InvariantAppend(sb.ToString()); sb.Clear(); } sb.Append(RolloutCmdletBase.FormatRolloutDetails(rollout)); sb.AppendFormatWithLeftIndentAndNewLineIfNotNull( RolloutCmdletBase.NoIndent, "Total Retry Attempts", rollout.TotalRetryAttempts.HasValue && rollout.TotalRetryAttempts > 0 ? rollout.TotalRetryAttempts.Value.ToString(CultureInfo.InvariantCulture) : null); if (rollout.OperationInfo != null) { sb.AppendFormatWithLeftIndentAndNewLine(NoIndent, RolloutCmdletBase.FormatOperationInfo(rollout.OperationInfo, RolloutCmdletBase.NoIndent)); } return(sb.ToString()); }
private static string FormatRolloutDetails(PSRollout rollout) { StringBuilder sb = new StringBuilder(); sb.AppendFormatWithLeftIndentAndNewLineIfNotNull(RolloutCmdletBase.NoIndent, "ArtifactSourceId", rollout.ArtifactSourceId); sb.AppendFormatWithLeftIndentAndNewLineIfNotNull(RolloutCmdletBase.NoIndent, "BuildVersion", rollout.BuildVersion); return(sb.ToString()); }
private void PrintDetails(PSRollout rollout) { var sb = new StringBuilder(); if (rollout != null && rollout.Services != null) { this.PrintServices(rollout.Services); } }
protected void PrintRollout(PSRollout rollout) { if (rollout != null) { verboseBuilder.InvariantAppend(this.FormatRolloutInfoHeader(rollout)); this.PrintDetails(rollout); this.WriteVerbose(verboseBuilder.ToString()); this.PrintError(); } }
private bool Delete() { if (this.InputObject != null) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.Name = this.InputObject.Name; } else if (!string.IsNullOrWhiteSpace(this.ResourceId)) { var parsedResourceId = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.Name = parsedResourceId.ResourceName; } var rolloutToDelete = new PSRollout() { ResourceGroupName = this.ResourceGroupName, Name = this.Name }; return(this.DeploymentManagerClient.DeleteRollout(rolloutToDelete)); }
private PSRollout Cancel() { if (this.InputObject != null) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.Name = this.InputObject.Name; } else if (!string.IsNullOrWhiteSpace(this.ResourceId)) { var parsedResourceId = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.Name = parsedResourceId.ResourceName; } var rolloutToCancel = new PSRollout() { ResourceGroupName = this.ResourceGroupName, Name = this.Name }; var canceledRollout = this.DeploymentManagerClient.CancelRollout(rolloutToCancel); return(canceledRollout); }
private PSRollout Restart() { if (this.InputObject != null) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.Name = this.InputObject.Name; } else if (!string.IsNullOrWhiteSpace(this.ResourceId)) { var parsedResourceId = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.Name = parsedResourceId.ResourceName; } var rolloutToRestart = new PSRollout() { ResourceGroupName = this.ResourceGroupName, Name = this.Name }; var restartedRollout = this.DeploymentManagerClient.RestartRollout(rolloutToRestart, this.SkipSucceeded); return(restartedRollout); }
internal bool DeleteRollout(PSRollout psRollout) { var result = _client.Rollouts.DeleteWithHttpMessagesAsync(psRollout.ResourceGroupName, psRollout.Name).GetAwaiter().GetResult(); return(result.Response.StatusCode == HttpStatusCode.OK || result.Response.StatusCode == HttpStatusCode.NoContent); }
internal PSRollout CancelRollout(PSRollout psRollout) { var rollout = _client.Rollouts.Cancel(psRollout.ResourceGroupName, psRollout.Name); return(new PSRollout(psRollout.ResourceGroupName, rollout)); }
internal PSRollout RestartRollout(PSRollout psRollout, bool?skipSucceeded = true) { var rollout = _client.Rollouts.Restart(psRollout.ResourceGroupName, psRollout.Name, skipSucceeded); return(new PSRollout(psRollout.ResourceGroupName, rollout)); }