feat(domains): enhance domain management with activation states and sync options
This commit is contained in:
@@ -69,12 +69,15 @@ export class DnsManager {
|
||||
this.cloudlyRef.authManager.validIdentityGuard,
|
||||
]);
|
||||
|
||||
// Validate domain exists if domainId is provided
|
||||
// Validate domain exists and is activated if domainId is provided
|
||||
if (reqArg.dnsEntryData.domainId) {
|
||||
const domain = await this.cloudlyRef.domainManager.CDomain.getDomainById(reqArg.dnsEntryData.domainId);
|
||||
if (!domain) {
|
||||
throw new Error(`Domain with id ${reqArg.dnsEntryData.domainId} not found`);
|
||||
}
|
||||
if ((domain.data as any).activationState !== 'activated') {
|
||||
throw new Error(`Domain ${domain.data.name} is not activated; DNS changes are not allowed.`);
|
||||
}
|
||||
// Set the zone from the domain name
|
||||
reqArg.dnsEntryData.zone = domain.data.name;
|
||||
}
|
||||
@@ -97,12 +100,15 @@ export class DnsManager {
|
||||
this.cloudlyRef.authManager.validIdentityGuard,
|
||||
]);
|
||||
|
||||
// Validate domain exists if domainId is provided
|
||||
// Validate domain exists and is activated if domainId is provided
|
||||
if (reqArg.dnsEntryData.domainId) {
|
||||
const domain = await this.cloudlyRef.domainManager.CDomain.getDomainById(reqArg.dnsEntryData.domainId);
|
||||
if (!domain) {
|
||||
throw new Error(`Domain with id ${reqArg.dnsEntryData.domainId} not found`);
|
||||
}
|
||||
if ((domain.data as any).activationState !== 'activated') {
|
||||
throw new Error(`Domain ${domain.data.name} is not activated; DNS changes are not allowed.`);
|
||||
}
|
||||
// Set the zone from the domain name
|
||||
reqArg.dnsEntryData.zone = domain.data.name;
|
||||
}
|
||||
@@ -258,4 +264,4 @@ export class DnsManager {
|
||||
public async stop() {
|
||||
console.log('DNS Manager stopped');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user