样书配置

使用 API 创建配置

使用样书 API 基于此样书创建配置。您可以使用任何工具,例如 cURL 命令行工具或 Postman Chrome 浏览器扩展程序,向 NetScaler 控制台发送 HTTP 请求。

以您在“如何创建样书以将 SSL 证书和证书密钥文件上载到 NetScaler 控制台”中创建的样书示例来上载证书和密钥文件 。使用 REST API 从样书创建配置包,如下所示:

POST

https://<ADM-endpoint-name>/stylebook/nitro/v2/config/configpacks?mode=async

{
    "configpack": {
        "stylebook": {
            "name": "lb",
            "namespace": "com.citrix.adc.stylebooks",
            "version": "1.1"
        },
        "parameters": {
            "lb-appname": "lbapp1",
            "lb-virtual-ip": "192.168.1.1",
            "lb-virtual-port": "443",
            "lb-service-type": "SSL",
            "svc-service-type": "HTTP",
            "svc-servers": [
                {
                    "ip": "193.1.1.1",
                    "port": "80"
                }
            ],
            "certificates": [
                {
                    "cert-name": "cert1",
                    "cert-file": {
                        "name": "c3.pem",
                        "contents": "<base64 encoded content>",
                        "encoding_type": "base64"
                    },
                    "ssl-inform": "PEM",
                    "key-file": {
                        "name": "c3.key",
                        "contents": "<base64 encoded content>",
                        "encoding_type": "base64"
                    }
                }
            ]
        },
        "targets": [
            {
                "instance_id": "1b322685-3b23-4111-a9ce-56dd1c659e4c"
            }
        ]
        }
    }
}
<!--NeedCopy-->

这将返回一个作业 ID,该作业 ID 可用于跟踪配置作业的完成情况:

{
    "job": {
        "job_id": "388922985"
    }
}
<!--NeedCopy-->

使用任务轮询 API 来了解任务的状态以及配置作业何时完成:

GET

https://<ADM-endpoint-name>/stylebook/nitro/v2/config/jobs/388922985

200 OK
{
    "job": {
        "job_id": "388922985",
        "status": "completed",
        "progress_info": [...],
        "result": {
            "config_key": "388922985",
            "created_by": "nsroot",
            "created_datetime": "2023-01-14 01:46:05.410998",
            "created_datetimestamp": "2023-01-14 01:46:05",
            "id": "388922985",
            "incarnation_number": "0",
            "last_modified_by": "nsroot",
            "last_modified_datetime": "2023-01-14 01:46:05",
            "lock": "Y",
            "name": "sample-dns-stylebook",
            "namespace": "com.citrix.adc.tests",
            "primary_keys": "{}",
            "sb_id": "samp4ed0c4c90aefaadaff6422b0c395f67f",
            "status": "completed",
            "target_devices_json": "[{"instance_id": "49a45044-ceb3-4e9d-8a5d-e3fe225d90ed", "id": "1833061454", "group_id": "", "instance_ip": "192.168.153.165", "hostname": "ctx-adc-dc01-v-prod-54", "instance_role": "[\\"default\\"]", "incarnation_number": "0"}]",
            "tenant_id": "1a45fd70-7ce3-4bff-8642-1bd7f7e97673",
            "version": "1.0"
        }
    }
}
<!--NeedCopy-->

任务 ID (388922985) 用于识别配置包。可以使用此 ID 查询、更新或删除该配置。

使用 API 创建配置

在本文中