示例#1
0
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        protected override void ProcessRecord()
        {
            try
            {
                RecoveryServicesProviderListResponse recoveryServicesProviderListResponse =
                    RecoveryServicesClient.GetAzureSiteRecoveryProvider(
                        this.Site.Name);

                if (recoveryServicesProviderListResponse.RecoveryServicesProviders.Count != 0)
                {
                    throw new PSInvalidOperationException(Properties.Resources.SiteRemovalWithRegisteredHyperVHostsError);
                }

                FabricDeletionInput input = new FabricDeletionInput()
                {
                    Properties = new FabricDeletionInputProperties()
                };

                LongRunningOperationResponse response =
                    RecoveryServicesClient.DeleteAzureSiteRecoveryFabric(this.Site.Name, input);

                JobResponse jobResponse =
                    RecoveryServicesClient
                    .GetAzureSiteRecoveryJobDetails(PSRecoveryServicesClient.GetJobIdFromReponseLocation(response.Location));

                WriteObject(new ASRJob(jobResponse.Job));
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
示例#2
0
 /// <summary>
 /// Deletes a fabric
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations.
 /// </param>
 /// <param name='fabricName'>
 /// Required. Fabric Name.
 /// </param>
 /// <param name='fabricDeletionInput'>
 /// Required. Fabric deletion input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static Task <LongRunningOperationResponse> DeleteAsync(this IFabricOperations operations, string fabricName, FabricDeletionInput fabricDeletionInput, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.DeleteAsync(fabricName, fabricDeletionInput, customRequestHeaders, CancellationToken.None));
 }
 /// <summary>
 /// Deletes Azure Site Recovery Fabric.
 /// </summary>
 /// <param name="createAndAssociatePolicyInput">Policy Input</param>
 /// <returns>Long operation response</returns>
 public LongRunningOperationResponse DeleteAzureSiteRecoveryFabric(string fabricName, FabricDeletionInput input)
 {
     return(this.GetSiteRecoveryClient().Fabrics.BeginDeleting(fabricName, input,
                                                               this.GetRequestHeaders()));
 }
示例#4
0
 /// <summary>
 /// Deletes a fabric
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations.
 /// </param>
 /// <param name='fabricName'>
 /// Required. Fabric Name.
 /// </param>
 /// <param name='fabricDeletionInput'>
 /// Required. Fabric deletion input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static LongRunningOperationResponse Delete(this IFabricOperations operations, string fabricName, FabricDeletionInput fabricDeletionInput, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IFabricOperations)s).DeleteAsync(fabricName, fabricDeletionInput, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }