func (s *Service) Delete(ctx context.Context, spec azure.Spec) error {
	diskSpec, ok := spec.(*Spec)
	if !ok {
		return errors.New("Invalid disk specification")
	}
	klog.V(2).Infof("deleting disk %s", diskSpec.Name)
	future, err := s.Client.Delete(ctx, s.Scope.MachineConfig.ResourceGroup, diskSpec.Name)
	if err != nil && azure.ResourceNotFound(err) {
		// already deleted
		return nil
	}
	if err != nil {
		return fmt.Errorf("failed to delete disk %s in resource group %s: %w", diskSpec.Name, s.Scope.MachineConfig.ResourceGroup, err)
	}

	// Do not wait until the operation completes. Just check the result
	// so the call to Delete actuator operation is async.
	_, err = future.Result(s.Client)
	if err != nil {
		return fmt.Errorf("result error: %w", err)
	}
	klog.V(2).Infof("successfully deleted disk %s", diskSpec.Name)
	return err
}
// Delete deletes the disk associated with a VM.
Delete deletes the disk associated with a VM.
// Delete deletes the disk associated with a VM .
func (s *Service) Delete(ctx context.Context, spec azure.Spec) error {
	diskSpec, ok := spec.(*Spec)
	if !ok {
		return errors.New("Invalid disk specification")
	}
	klog.V(2).Infof("deleting disk %s", diskSpec.Name)
	future, err := s.Client.Delete(ctx, s.Scope.MachineConfig.ResourceGroup, diskSpec.Name)
	if err != nil && azure.ResourceNotFound(err) {
		return nil
	}
	if err != nil {
		return fmt.Errorf("failed to delete disk %s in resource group %s: %w", diskSpec.Name, s.Scope.MachineConfig.ResourceGroup, err)
	}
	_, err = future.Result(s.Client)
	if err != nil {
		return fmt.Errorf("result error: %w", err)
	}
	klog.V(2).Infof("successfully deleted disk %s", diskSpec.Name)
	return err
}
func ( s * Service ) Delete ( ctx context . Context , spec azure . Spec ) error { diskSpec , ok := spec . ( * Spec ) if ! ok { return errors . New ( " " ) } klog . V ( 2 ) . Infof ( " " , diskSpec . Name ) future , err := s . Client . Delete ( ctx , s . Scope . MachineConfig . ResourceGroup , diskSpec . Name ) if err != nil && azure . ResourceNotFound ( err ) { return nil } if err != nil { return fmt . Errorf ( " " , diskSpec . Name , s . Scope . MachineConfig . ResourceGroup , err ) } _ , err = future . Result ( s . Client ) if err != nil { return fmt . Errorf ( " " , err ) } klog . V ( 2 ) . Infof ( " " , diskSpec . Name ) return err }
Delete deletes the disk associated with a VM.
Delete deletes the disk associated with a VM .
// already deleted // Do not wait until the operation completes. Just check the result // so the call to Delete actuator operation is async.