You need to enable JavaScript to run this app.
导航
域名管理
最近更新时间:2024.12.05 16:23:56首次发布时间:2024.02.02 14:01:56

阅读本文,您可以获取 Java SDK 域名管理的接口调用示例,实现快速开发。

调用说明

  • 本文提供的接口调用示例均通过 AK 和 SK 初始化实例。
  • 接口的参数说明和错误码等信息可通过接口文档查看。

前提条件

调用接口前,请先完成 Java SDK 的安装及初始化操作。

调用示例

本节为您介绍域名管理相关接口的功能和调用示例。

新增域名

您可以调用 AddDomainV1 接口新增域名。详细的参数说明可参见 AddDomainV1 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class AddDomainV1Example {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        AddDomainV1Query query = new AddDomainV1Query();
        AddDomainV1Body body = new AddDomainV1Body();
        
        try {
            AddDomainV1Res resp = service.addDomainV1(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

删除域名

您可以调用 DelDomain 接口删除指定域名。详细的参数说明可参见 DelDomain 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*; 
import com.volcengine.service.imagex.v2.ImagexService;

public class DelDomainExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        DelDomainQuery query = new DelDomainQuery();
        DelDomainBody body = new DelDomainBody();
        
        try {
            DelDomainRes resp = service.delDomain(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新域名配置

您可以调用 UpdateImageDomainConfig 接口更新域名配置。详细的参数说明可参见 UpdateImageDomainConfig 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainConfigExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainConfigQuery query = new UpdateImageDomainConfigQuery();
        UpdateImageDomainConfigBody body = new UpdateImageDomainConfigBody();
        
        try {
            UpdateImageDomainConfigRes resp = service.updateImageDomainConfig(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新响应头配置

您可以调用 UpdateResponseHeader 接口更新响应头配置。详细的参数说明可参见 UpdateResponseHeader 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateResponseHeaderExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateResponseHeaderQuery query = new UpdateResponseHeaderQuery();
        UpdateResponseHeaderBody body = new UpdateResponseHeaderBody();
        
        try {
            UpdateResponseHeaderRes resp = service.updateResponseHeader(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新默认域名配置

您可以调用 SetDefaultDomain 接口更新默认域名配置。详细的参数说明可参见 SetDefaultDomain 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class SetDefaultDomainExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        SetDefaultDomainBody body = new SetDefaultDomainBody();

        try {
            SetDefaultDomainRes resp = service.setDefaultDomain(body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新 Referer 防盗链配置

您可以调用 UpdateRefer 接口更新 Referer 防盗链配置。详细的参数说明可参见 UpdateRefer 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateReferExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateReferQuery query = new UpdateReferQuery();
        UpdateReferBody body = new UpdateReferBody();
        
        try {
            UpdateReferRes resp = service.updateRefer(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新 https 配置

您可以调用 UpdateHttps 接口更新 https 配置。详细的参数说明可参见 UpdateHttps 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateHttpsExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateHttpsQuery query = new UpdateHttpsQuery();
        UpdateHttpsBody body = new UpdateHttpsBody();
        
        try {
            UpdateHttpsRes resp = service.updateHttps(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新 IP 黑白名单配置

您可以调用 UpdateImageDomainIPAuth 接口更新 IP 黑白名单配置。详细的参数说明可参见 UpdateImageDomainIPAuth 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainIPAuthExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainIPAuthQuery query = new UpdateImageDomainIPAuthQuery();
        UpdateImageDomainIPAuthBody body = new UpdateImageDomainIPAuthBody();
        
        try {
            UpdateImageDomainIPAuthRes resp = service.updateImageDomainIPAuth(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新 UA 黑白名单配置

您可以调用 UpdateImageDomainUaAccess 接口更新 UA 黑白名单配置。详细的参数说明可参见 UpdateImageDomainUaAccess 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainUaAccessExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainUaAccessQuery query = new UpdateImageDomainUaAccessQuery();
        UpdateImageDomainUaAccessBody body = new UpdateImageDomainUaAccessBody();
        
        try {
            UpdateImageDomainUaAccessRes resp = service.updateImageDomainUaAccess(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新地域访问限制配置

您可以调用 UpdateImageDomainAreaAccess 接口更新地域访问限制配置。详细的参数说明可参见 UpdateImageDomainAreaAccess 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainAreaAccessExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainAreaAccessQuery query = new UpdateImageDomainAreaAccessQuery();
        UpdateImageDomainAreaAccessBody body = new UpdateImageDomainAreaAccessBody();
        
        try {
            UpdateImageDomainAreaAccessRes resp = service.updateImageDomainAreaAccess(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新域名自适应格式配置

您可以调用 UpdateDomainAdaptiveFmt 接口更新域名自适应格式配置。详细的参数说明可参见 UpdateDomainAdaptiveFmt 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateDomainAdaptiveFmtExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateDomainAdaptiveFmtQuery query = new UpdateDomainAdaptiveFmtQuery();
        UpdateDomainAdaptiveFmtBody body = new UpdateDomainAdaptiveFmtBody();
        
        try {
            UpdateDomainAdaptiveFmtRes resp = service.updateDomainAdaptiveFmt(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新集智瘦身配置

您可以调用 UpdateSlimConfig 接口更新集智瘦身配置。详细的参数说明可参见 UpdateSlimConfig 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateSlimConfigExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateSlimConfigQuery query = new UpdateSlimConfigQuery();
        UpdateSlimConfigBody body = new UpdateSlimConfigBody();
        
        try {
            UpdateSlimConfigRes resp = service.updateSlimConfig(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新域名高级配置

您可以调用 UpdateAdvance 接口更新域名高级配置。详细的参数说明可参见 UpdateAdvance 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateAdvanceExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateAdvanceQuery query = new UpdateAdvanceQuery();
        UpdateAdvanceBody body = new UpdateAdvanceBody();
        
        try {
            UpdateAdvanceRes resp = service.updateAdvance(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新带宽限制配置

您可以调用 UpdateImageDomainBandwidthLimit 接口更新带宽限制配置。详细的参数说明可参见 UpdateImageDomainBandwidthLimit 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainBandwidthLimitExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainBandwidthLimitQuery query = new UpdateImageDomainBandwidthLimitQuery();
        UpdateImageDomainBandwidthLimitBody body = new UpdateImageDomainBandwidthLimitBody();
        
        try {
            UpdateImageDomainBandwidthLimitRes resp = service.updateImageDomainBandwidthLimit(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新下载限速配置

您可以调用 UpdateImageDomainDownloadSpeedLimit 接口更新下载限速配置。详细的参数说明可参见 UpdateImageDomainDownloadSpeedLimit 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class UpdateImageDomainDownloadSpeedLimitExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        UpdateImageDomainDownloadSpeedLimitQuery query = new UpdateImageDomainDownloadSpeedLimitQuery();
        UpdateImageDomainDownloadSpeedLimitBody body = new UpdateImageDomainDownloadSpeedLimitBody();
        
        try {
            UpdateImageDomainDownloadSpeedLimitRes resp = service.updateImageDomainDownloadSpeedLimit(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取域名配置

您可以调用 GetDomainConfig 接口获取域名配置。详细的参数说明可参见 GetDomainConfig 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class GetDomainConfigExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        GetDomainConfigQuery query = new GetDomainConfigQuery();

        try {
            GetDomainConfigRes resp = service.getDomainConfig(query);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取服务下全部域名

您可以调用 GetServiceDomains 接口获取服务下全部域名。详细的参数说明可参见 GetServiceDomains 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*;
import com.volcengine.service.imagex.v2.ImagexService;

public class GetServiceDomainsExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        GetServiceDomainsQuery query = new GetServiceDomainsQuery();

        try {
            GetServiceDomainsRes resp = service.getServiceDomains(query);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取响应头允许的 key 列表

您可以调用 GetResponseHeaderValidateKeys 接口获取当前账号全部合法的响应头 key 信息。详细的参数说明可参见 GetResponseHeaderValidateKeys 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*; 
import com.volcengine.service.imagex.v2.ImagexService;

public class GetResponseHeaderValidateKeysExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        try {
            GetResponseHeaderValidateKeysRes resp = service.getResponseHeaderValidateKeys();
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}