Domains and DNS > 4 - DNS Management > Remove a DNS service

4.4 Remove a DNS service

By using the Aruba WsDNS method SetRemoveDNS authenticated user can remove a Dns zone owned.
Parametri
DNSServiceID
Type: int
Identificatore del servizio DNS.


    /// WsDns.SetRemoveDNS Method (c# .NET)
    public static string SetRemoveDNS(WsDNSClient client,
        int DNSServiceID)
    {
        //specify the account login details 
        client.ClientCredentials.UserName.UserName = "ARU-0000";
        client.ClientCredentials.UserName.Password = "0123456789";

        StringBuilder stringBuilder = new StringBuilder();

        try
        {
            SetRemoveDNSRequest request = new SetRemoveDNSRequest();
            request.DNSServiceID = DNSServiceID;

            // call method SetRemoveDNS 
            // obtaining a WsResultOfSetRemoveDNSResponse item
            WsResultOfSetRemoveDNSResponse result = 
                client.SetRemoveDNS(request);

            //if the call is Success print value
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation end successfully.\n");
                stringBuilder.Append("\nJobID: ");
                stringBuilder.Append(result.Value.JobID);
                stringBuilder.Append("\nStatus : ");
                stringBuilder.Append(result.Value.Status);
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDns.SetRemoveDNS Method (JAVA)
public static String SetRemoveDNS(IWsDNS client,
        int DNSServiceID) 
    {
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try {
        SetRemoveDNSRequest request = new SetRemoveDNSRequest();
        request.setDNSServiceID(DNSServiceID);

        // call method SetRemoveDNS 
        // obtaining a WsResultOfSetRemoveDNSResponse item
        WsResultOfSetRemoveDNSResponse result = client.setRemoveDNS(request);

        //if the call is Success print value
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation end successfully.\n");
            stringBuilder.append("\nJobID: ");
            stringBuilder.append(result.getValue().getJobID());
            stringBuilder.append("\nStatus : ");
            stringBuilder.append(result.getValue().getStatus());
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        //show error
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
Versione
API: v2.8 URL:https://api.services.cloud.it/wsDns/v2.8/WsDns.svc?wsdl
See also