Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.4 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { digitalOceanAuth, DigitalOceanAuthValue } from '../common/auth';
import { digitalOceanApiCall, getAuthFromValue } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';

export const deleteDomain = createAction({
  auth: digitalOceanAuth,
  name: 'delete_domain',
  displayName: 'Delete Domain',
  description: 'Remove a domain from your DigitalOcean account.',
  audience: 'both',
  aiMetadata: { description: 'Permanently deletes a DNS domain (and its records) from the DigitalOcean account, identified by exact domain name. Use to tear down DNS for a domain you no longer manage. Destructive; effectively idempotent on the end state but the first call removes the domain and later calls on a missing domain fail.', idempotent: false },
  props: {
    domain_name: Property.ShortText({
      displayName: 'Domain Name',
      description: 'The domain name to delete (e.g., example.com).',
      required: true,
    }),
  },
  async run(context) {
    const { domain_name } = context.propsValue;

    await digitalOceanApiCall<void>({
      method: HttpMethod.DELETE,
      path: `/domains/${encodeURIComponent(domain_name)}`,
      auth: getAuthFromValue(context.auth as DigitalOceanAuthValue),
    });

    return {
      success: true,
      message: `Domain '${domain_name}' has been deleted.`,
    };
  },
});