delete bulk and export/import
Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
27
app/api/domains/[domain]/export/route.js
Archivo normal
27
app/api/domains/[domain]/export/route.js
Archivo normal
@@ -0,0 +1,27 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import ovhService from '@/lib/ovh-service';
|
||||
|
||||
export async function GET(request, { params }) {
|
||||
try {
|
||||
const { domain } = await params;
|
||||
|
||||
// Get all records
|
||||
const records = await ovhService.getDNSRecords(domain);
|
||||
|
||||
// Export to BIND9 format
|
||||
const zoneFile = ovhService.exportToBind9(domain, records);
|
||||
|
||||
return new NextResponse(zoneFile, {
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
'Content-Disposition': `attachment; filename="${domain}.zone"`
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error exporting DNS zone:', error);
|
||||
return NextResponse.json(
|
||||
{ success: false, error: error.message },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Referencia en una nueva incidencia
Block a user