示例#1
0
        public void RestoreSnapshot(string resourceGroupName, string webSiteName, string slotName,
                                    SnapshotRestoreRequest restoreReq)
        {
            string qualifiedSiteName;
            bool   useSlot = CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName);

            if (useSlot)
            {
                WrappedWebsitesClient.WebApps().RestoreSnapshotSlot(resourceGroupName, webSiteName, restoreReq, slotName);
            }
            else
            {
                WrappedWebsitesClient.WebApps().RestoreSnapshot(resourceGroupName, webSiteName, restoreReq);
            }
        }
示例#2
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            var sourceApp = new PSSite(WebsitesClient.GetWebApp(InputObject.ResourceGroupName, InputObject.Name, InputObject.Slot));
            SnapshotRecoverySource source = new SnapshotRecoverySource()
            {
                Location = sourceApp.Location,
                Id       = sourceApp.Id
            };
            SnapshotRestoreRequest recoveryReq = new SnapshotRestoreRequest()
            {
                Overwrite                  = true,
                SnapshotTime               = this.InputObject.SnapshotTime.ToString("o"),
                RecoverConfiguration       = this.RecoverConfiguration,
                IgnoreConflictingHostNames = true,
                RecoverySource             = source
            };
            Action recoverAction = () => WebsitesClient.RestoreSnapshot(ResourceGroupName, Name, Slot, recoveryReq);

            ConfirmAction(this.Force.IsPresent, "Web app contents will be overwritten with the contents of the snapshot.",
                          "The snapshot has been restored.", Name, recoverAction);
        }
 public Task <SnapshotRestoreResponse> RestoreAsync(SnapshotRestoreRequest request, CancellationToken cancellationToken = default)
 {
     request.BeforeRequest();
     return(DoRequestAsync <SnapshotRestoreRequest, SnapshotRestoreResponse>(request, cancellationToken));
 }
 public SnapshotRestoreResponse Restore(SnapshotRestoreRequest request)
 {
     request.BeforeRequest();
     return(DoRequest <SnapshotRestoreRequest, SnapshotRestoreResponse>(request));
 }