CdmQuery - 범위 지정됨

  • 릴리스 버전: Zurich
  • 업데이트 날짜 2025년 07월 31일
  • 소요 시간: 74분
  • CdmQuery 스크립트 포함은 데이터 모델 트리를 CDM 쿼리할 수 있는 메서드를 제공합니다. CDM 노드 [sn_cdm_node] 테이블의 특정 필드/열인 노드 객체 목록을 반환합니다. 이러한 값은 개체의 속성으로 반환됩니다. 모든 개체는 데이터 모델의 노드입니다.

    이 스크립트 포함은 유창하므로 대부분의 메서드가 연결을 지원하고 CdmQuery 객체를 반환합니다. 이 스크립트 포함 내의 메서드는 다양한 유형으로 분류됩니다. 형식에 따라 호출 내에서 특정 순서로 지정해야 합니다. 결과 메서드를 제외한 모든 메서드는 연결할 수 있습니다.

    주:
    이 설명서에서는 스냅샷 데이터를 쿼리할 때 CdmQuery 스크립트 포함의 사용법만 다루므로 이 프로세스에 필요한 메서드만 현재 문서화되어 있습니다. 데이터 검증을 위한 PaCE 정책 스크립트와 CDM 데이터 익스포트를 위한 익스포터 스크립트를 작성할 때는 스냅샷 데이터를 쿼리하는 데 필요합니다.
    메서드 유형:

    snapshotId()query() 메서드는 필수입니다. filter와 setting 메서드는 query() 메서드 앞에, snapshotId() 메서드 뒤에 추가해야 합니다. 필터 및 설정 방법을 추가하는 순서는 충돌하지 않는 한 중요하지 않으며, 이 경우 최신 관련 방법이 우선합니다. query() 메서드 뒤에 결과를 가져오려면 getTree()와 같은 결과 메서드를 추가해야 합니다.

    예:
    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
      .decryptPassword(true)
      .includeFileMetadata()
      .query()
      .getTree(true, false);

    이 API는 sn_cdm 네임스페이스에서 실행되며, 다양한 메서드에 액세스하려면 sn_cdm.cdm_viewer 또는 sn_cdm.cdm_secrets 역할이 있어야 합니다.

    Cdm쿼리 - CdmQuery()

    CdmQuery 개체를 인스턴스화합니다. 다른 CdmQuery 메서드를 호출하기 전에 이 메서드를 호출해야 합니다.

    표 1. 매개변수
    이름 유형 설명
    없음

    다음 코드 예제에서는 CdmQuery 메서드를 호출하여 sn_cdm 네임스페이스에서 CdmQuery 개체를 인스턴스화하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
    .decryptPassword(true)
    .query()
    .getTree();

    CdmQuery - decryptPassword(부울 암호 해독)

    암호화된 구성 데이터 항목(CDI) 및 변수 노드에 대해 암호가 해제된 값이 결과에 반환되는지 여부를 지정할 수 있습니다.

    사용자에게 필요한 sn_cdm.cdm_secrets 역할이 없는 경우 오류가 발생합니다.

    표 2. 매개변수
    이름 유형 설명
    해독하다 부울 옵션입니다. CDI 및 변수 노드에 대해 해독된 값을 반환할지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: CDI 및 변수 노드에 대해 해독된 값을 반환합니다.
    • false: CDI 및 변수 노드에 대해 암호화된 값을 반환합니다.

    기본값: false

    표 3. 반환
    유형 설명
    없음

    다음 코드 예제는 CdmQuery() API를 호출하고 CDI 및 변수 노드에 대해 암호화된 값을 반환하도록 지정하는 방법을 보여줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("9f12a80047352150fd6ce977746d4364")
    .decryptPassword(false)
    .query()
    .getTree(true,true);
    
    gs.info(primarySnapshot);

    반환 결과:

    {
      "Development_1": {
        "vars": {},
        "services": {
          "vars": {},
          "paymentComponent": {
            "applicationSLA": "24x7",
            "paymentService": {
              "database": {
                "backup": {
                  "dbServer": "db23.paymentx.be"
                },
                "dbIpAddress": "10.20.40.50",
                "dbName": "paymentX_dev2",
                "dbPort": "8050",
                "dbServer": "db22.paymentx.be",
                "dbUserName": "root",
                "dbPassword": "*******"
              }
            }
          }
        }
      }
    }

    다음 코드 예제에서는 CdmQuery() API를 호출하고 CDI 및 변수 노드에 대해 암호 해독된 값을 반환하도록 지정하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("9f12a80047352150fd6ce977746d4364")
    .decryptPassword(true)
    .query()
    .getTree(true,true);
    
    gs.info(primarySnapshot);

    반환 결과:

    {
      "Development_1": {
        "vars": {},
        "services": {
          "vars": {},
          "paymentComponent": {
            "applicationSLA": "24x7",
            "paymentService": {
              "database": {
                "backup": {
                  "dbServer": "db23.paymentx.be"
                },
                "dbIpAddress": "10.20.40.50",
                "dbName": "paymentX_dev2",
                "dbPort": "8050",
                "dbServer": "db22.paymentx.be",
                "dbUserName": "root",
                "dbPassword": "dev1-password"
              }
            }
          }
        }
      }
    }

    CdmQuery - followIncludes(부울 followIncludes)

    참조된 노드의 하위 노드가 연결된 노드 아래에 나타나도록 연결된 노드가 완전히 확인되는지 여부를 지정할 수 있습니다.

    표 4. 매개변수
    이름 유형 설명
    팔로우포함 부울 옵션입니다. 연결된 노드가 완전히 확인되었는지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: 연결된 노드가 완전히 해결됩니다.
    • false: 연결된 노드가 완전히 확인되지 않았습니다.

    기본값: true

    표 5. 반환
    유형 설명
    없음

    다음 코드 예제에서는 완전히 확인 followIncludes 됨 = true인 데이터를 반환하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("9f12a80047352150fd6ce977746d4364")
      .followIncludes(true)
      .query()
      .getTree(false, true);

    반환 데이터 예시:

    {
      "sys_id": "62a0a0cc47f12150fd6ce977746d431a",
      "type": "sn_cdm_node_deployable",
      "main_id": "111673",
      "name": "Development_1",
      "node_path": "!K<+!K<0!K<1",
      "effective_path": "!K<+!K<0!K<1",
      "main_id_encoded": "K<1",
      "node_classifier": "/application/deployables/env:Development",
      "status": "valid",
      "level": "2",
      "children": [
        {
          "sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
          "type": "sn_cdm_node_folder",
          "main_id": "111674",
          "name": "vars",
          "node_path": "!K<+!K<0!K<1!K<2",
          "effective_path": "!K<+!K<0!K<1!K<2",
          "main_id_encoded": "K<2",
          "node_classifier": "/application/deployables/env:Development/vars",
          "status": "valid",
          "level": "3",
          "children": [],
          "hasParent": true
        },
        {
          "sys_id": "2ca1600047352150fd6ce977746d4391",
          "type": "sn_cdm_node_linked",
          "main_id": "111693",
          "name": "services",
          "node_path": "!K<+!K<0!K<1!K<G",
          "effective_path": "!K<+!K<0!K<1!K<G",
          "main_id_encoded": "K<G",
          "node_classifier": "/application/deployables/env:Development",
          "status": "valid",
          "level": "3",
          "children": [
            {
              "sys_id": "2bb0e0cc47f12150fd6ce977746d43e2",
              "type": "sn_cdm_node_folder",
              "main_id": "111680",
              "name": "vars",
              "node_path": "!K<+!K</!K<7!K<8",
              "effective_path": "!K<+!K<0!K<1!K<G!K<8",
              "main_id_encoded": "K<8",
              "node_classifier": "/application/collections/vars",
              "status": "valid",
              "level": "3",
              "children": [],
              "hasParent": true
            },
            {
              "sys_id": "ccf1640047352150fd6ce977746d438b",
              "type": "sn_cdm_node_component",
              "main_id": "111697",
              "name": "paymentComponent",
              "node_path": "!K<+!K<0!K<1!K<G!K<K",
              "effective_path": "!K<+!K<0!K<1!K<G!K<K",
              "main_id_encoded": "K<K",
              "node_classifier": "/application/deployables/env:Development",
              "status": "valid",
              "level": "4",
              "children": [
                {
                  "sys_id": "7fd064cc47f12150fd6ce977746d4372",
                  "type": "sn_cdm_node_cdi",
                  "main_id": "111682",
                  "name": "applicationSLA",
                  "node_path": "!K<+!K<,!K<9!K<:",
                  "value": "24x7",
                  "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<:",
                  "main_id_encoded": "K<:",
                  "node_classifier": "/application/components",
                  "status": "valid",
                  "level": "3",
                  "children": [],
                  "hasParent": true
                },
                {
                  "sys_id": "44f1a40047352150fd6ce977746d43dc",
                  "type": "sn_cdm_node_component",
                  "main_id": "111698",
                  "name": "paymentService",
                  "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "main_id_encoded": "K<L",
                  "node_classifier": "/application/deployables/env:Development",
                  "status": "valid",
                  "level": "5",
                  "children": [
                    {
                      "sys_id": "8cf1a40047352150fd6ce977746d43dc",
                      "type": "sn_cdm_node_component",
                      "main_id": "111699",
                      "name": "database",
                      "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "main_id_encoded": "K<M",
                      "node_classifier": "/application/deployables/env:Development",
                      "status": "valid",
                      "level": "6",
                      "children": [
                        {
                          "sys_id": "b3d064cc47f12150fd6ce977746d4374",
                          "type": "sn_cdm_node_component",
                          "main_id": "111685",
                          "name": "backup",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<?",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?",
                          "main_id_encoded": "K<?",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [
                            {
                              "sys_id": "7bd064cc47f12150fd6ce977746d4374",
                              "type": "sn_cdm_node_cdi",
                              "main_id": "111686",
                              "name": "dbServer",
                              "node_path": "!K<+!K<,!K<9!K<;!K<<!K<?!K<@",
                              "value": "db23.paymentx.be",
                              "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@",
                              "main_id_encoded": "K<@",
                              "node_classifier": "/application/components",
                              "status": "valid",
                              "level": "6",
                              "children": [],
                              "hasParent": true
                            }
                          ],
                          "hasParent": true
                        },
                        {
                          "sys_id": "33d064cc47f12150fd6ce977746d4375",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111687",
                          "name": "dbIpAddress",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<A",
                          "value": "10.20.40.50",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A",
                          "main_id_encoded": "K<A",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "f7d064cc47f12150fd6ce977746d4375",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111688",
                          "name": "dbName",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<B",
                          "value": "paymentX_dev2",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B",
                          "main_id_encoded": "K<B",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "77d064cc47f12150fd6ce977746d4376",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111690",
                          "name": "dbPort",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<D",
                          "value": "8050",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D",
                          "main_id_encoded": "K<D",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "3fd064cc47f12150fd6ce977746d4376",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111691",
                          "name": "dbServer",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<E",
                          "value": "db22.paymentx.be",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E",
                          "main_id_encoded": "K<E",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "f3d064cc47f12150fd6ce977746d4377",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111692",
                          "name": "dbUserName",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<F",
                          "value": "root",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F",
                          "main_id_encoded": "K<F",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "c4f1a40047352150fd6ce977746d43dd",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111700",
                          "name": "dbPassword",
                          "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "secure_value": "﷞﷟﷒dac329a2476c6110fd6ce977746d43e1﷬﷔1﷬﷭w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=﷮﷯",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "main_id_encoded": "K<N",
                          "node_classifier": "/application/deployables/env:Development",
                          "status": "valid",
                          "level": "7",
                          "masked_value": "*******",
                          "children": [],
                          "hasParent": true
                        }
                      ],
                      "hasParent": true
                    }
                  ],
                  "hasParent": true
                }
              ],
              "hasParent": true
            }
          ],
          "hasParent": true
        }
      ]
    }

    다음 코드 예제에서는 완전히 확인 followIncludes 되지 않은 데이터 = false를 반환하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("9f12a80047352150fd6ce977746d4364")
      .followIncludes(false)
      .query()
      .getTree(false, true);

    반환 데이터 예시:

    {
      "sys_id": "62a0a0cc47f12150fd6ce977746d431a",
      "type": "sn_cdm_node_deployable",
      "main_id": "111673",
      "name": "Development_1",
      "node_path": "!K<+!K<0!K<1",
      "effective_path": "!K<+!K<0!K<1",
      "main_id_encoded": "K<1",
      "node_classifier": "/application/deployables/env:Development",
      "status": "valid",
      "level": "2",
      "children": [
        {
          "sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
          "type": "sn_cdm_node_folder",
          "main_id": "111674",
          "name": "vars",
          "node_path": "!K<+!K<0!K<1!K<2",
          "effective_path": "!K<+!K<0!K<1!K<2",
          "main_id_encoded": "K<2",
          "node_classifier": "/application/deployables/env:Development/vars",
          "status": "valid",
          "level": "3",
          "children": [],
          "hasParent": true
        },
        {
          "sys_id": "2ca1600047352150fd6ce977746d4391",
          "type": "sn_cdm_node_linked",
          "main_id": "111693",
          "name": "services",
          "node_path": "!K<+!K<0!K<1!K<G",
          "effective_path": "!K<+!K<0!K<1!K<G",
          "main_id_encoded": "K<G",
          "node_classifier": "/application/deployables/env:Development",
          "status": "valid",
          "level": "3",
          "children": [
            {
              "sys_id": "ccf1640047352150fd6ce977746d438b",
              "type": "sn_cdm_node_component",
              "main_id": "111697",
              "name": "paymentComponent",
              "node_path": "!K<+!K<0!K<1!K<G!K<K",
              "effective_path": "!K<+!K<0!K<1!K<G!K<K",
              "main_id_encoded": "K<K",
              "node_classifier": "/application/deployables/env:Development",
              "status": "valid",
              "level": "4",
              "children": [
                {
                  "sys_id": "44f1a40047352150fd6ce977746d43dc",
                  "type": "sn_cdm_node_component",
                  "main_id": "111698",
                  "name": "paymentService",
                  "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "main_id_encoded": "K<L",
                  "node_classifier": "/application/deployables/env:Development",
                  "status": "valid",
                  "level": "5",
                  "children": [
                    {
                      "sys_id": "8cf1a40047352150fd6ce977746d43dc",
                      "type": "sn_cdm_node_component",
                      "main_id": "111699",
                      "name": "database",
                      "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "main_id_encoded": "K<M",
                      "node_classifier": "/application/deployables/env:Development",
                      "status": "valid",
                      "level": "6",
                      "children": [
                        {
                          "sys_id": "c4f1a40047352150fd6ce977746d43dd",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111700",
                          "name": "dbPassword",
                          "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "secure_value": "﷞﷟﷒dac329a2476c6110fd6ce977746d43e1﷬﷔1﷬﷭w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=﷮﷯",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "main_id_encoded": "K<N",
                          "node_classifier": "/application/deployables/env:Development",
                          "status": "valid",
                          "level": "7",
                          "masked_value": "*******",
                          "children": [],
                          "hasParent": true
                        }
                      ],
                      "hasParent": true
                    }
                  ],
                  "hasParent": true
                }
              ],
              "hasParent": true
            }
          ],
          "hasParent": true
        }
      ]
    }

    CdmQuery - forEach(함수 함수)

    각 결과 노드를 반복하고 CdmNode 객체를 허용하는 제공된 함수를 적용합니다.

    표 6. 매개변수
    이름 유형 설명
    함수 함수 CdmNode 개체에 적용할 함수입니다.
    표 7. 반환
    유형 설명
    없음

    이 코드 예제에서는 forEach() 메서드를 호출하는 방법을 보여 줍니다.

    CdmQuery.forEach(function (node) {
      gs.info("Node - {0}:{1} ", [node.getValue("name"), node.getValue("value")]);
    });

    CdmQuery - getTree(부울 simpleTree, 부울 prettify)

    지정된 CDM 쿼리 결과를 반환합니다.

    호출 내에서 연결된 플래그를 설정하여 반환할 콘텐츠의 수준과 형식을 지정할 수 있습니다. 기본값은 노드 메타데이터와 해당 자식 노드를 포함하고 항목 노드가 최상위 노드인 형식이 지정된 문자열을 반환하는 것입니다.

    표 8. 매개변수
    이름 유형 설명
    심플트리 부울 옵션입니다. 반환할 컨텐츠의 수준을 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: 모든 노드 메타데이터를 제외하고 계층적 키-값 쌍의 단순화된 JSON 객체를 반환합니다.
    • false: 노드 메타데이터와 모든 자식 노드를 포함하는 JSON 개체를 반환하고 항목 노드가 최상위 노드인 위치를 지정합니다.

    기본값: false

    예쁘게 부울 옵션입니다. JSON 객체 대신 서식이 지정된 문자열을 반환할지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: JSON 객체의 컨텐츠를 반환합니다.
    • false: 서식이 지정된 문자열로 콘텐츠를 반환합니다. 이 옵션은 응답에 새 줄과 이스케이프 문자를 추가할 때 UI 및 익스포터에서만 사용합니다.

    기본값: false

    표 9. 반환
    유형 설명
    Cdm쿼리 지정된 쿼리 정보를 포함하는 CdmQuery 객체입니다.

    다음 코드 예제에서는 기본 설정을 사용하여 getTree() 메서드를 호출하는 방법을 보여 줍니다. 노드 메타데이터와 모든 하위 노드를 포함하는 형식이 지정된 문자열을 반환합니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("9f12a80047352150fd6ce977746d4364")
      .query()
      .getTree();
    
    gs.info(JSON.stringify(primarySnapshot));

    반환 결과:

    {"sys_id":"62a0a0cc47f12150fd6ce977746d431a","type":"sn_cdm_node_deployable","main_id":"111673","name":"Development_1","node_path":"!K<+!K<0!K<1","effective_path":"!K<+!K<0!K<1","main_id_encoded":"K<1","node_classifier":"/application/deployables/env:Development","status":"valid","level":"2","children":[{"sys_id":"2aa0a0cc47f12150fd6ce977746d431a","type":"sn_cdm_node_folder","main_id":"111674","name":"vars","node_path":"!K<+!K<0!K<1!K<2","effective_path":"!K<+!K<0!K<1!K<2","main_id_encoded":"K<2","node_classifier":"/application/deployables/env:Development/vars","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"2ca1600047352150fd6ce977746d4391","type":"sn_cdm_node_linked","main_id":"111693","name":"services","node_path":"!K<+!K<0!K<1!K<G","effective_path":"!K<+!K<0!K<1!K<G","main_id_encoded":"K<G","node_classifier":"/application/deployables/env:Development","status":"valid","level":"3","children":[{"sys_id":"2bb0e0cc47f12150fd6ce977746d43e2","type":"sn_cdm_node_folder","main_id":"111680","name":"vars","node_path":"!K<+!K</!K<7!K<8","effective_path":"!K<+!K<0!K<1!K<G!K<8","main_id_encoded":"K<8","node_classifier":"/application/collections/vars","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"ccf1640047352150fd6ce977746d438b","type":"sn_cdm_node_component","main_id":"111697","name":"paymentComponent","node_path":"!K<+!K<0!K<1!K<G!K<K","effective_path":"!K<+!K<0!K<1!K<G!K<K","main_id_encoded":"K<K","node_classifier":"/application/deployables/env:Development","status":"valid","level":"4","children":[{"sys_id":"7fd064cc47f12150fd6ce977746d4372","type":"sn_cdm_node_cdi","main_id":"111682","name":"applicationSLA","node_path":"!K<+!K<,!K<9!K<:","value":"24x7","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<:","main_id_encoded":"K<:","node_classifier":"/application/components","status":"valid","level":"3","children":[],"hasParent":true},{"sys_id":"44f1a40047352150fd6ce977746d43dc","type":"sn_cdm_node_component","main_id":"111698","name":"paymentService","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L","main_id_encoded":"K<L","node_classifier":"/application/deployables/env:Development","status":"valid","level":"5","children":[{"sys_id":"8cf1a40047352150fd6ce977746d43dc","type":"sn_cdm_node_component","main_id":"111699","name":"database","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M","main_id_encoded":"K<M","node_classifier":"/application/deployables/env:Development","status":"valid","level":"6","children":[{"sys_id":"b3d064cc47f12150fd6ce977746d4374","type":"sn_cdm_node_component","main_id":"111685","name":"backup","node_path":"!K<+!K<,!K<9!K<;!K<<!K<?","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?","main_id_encoded":"K<?","node_classifier":"/application/components","status":"valid","level":"5","children":[{"sys_id":"7bd064cc47f12150fd6ce977746d4374","type":"sn_cdm_node_cdi","main_id":"111686","name":"dbServer","node_path":"!K<+!K<,!K<9!K<;!K<<!K<?!K<@","value":"db23.paymentx.be","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@","main_id_encoded":"K<@","node_classifier":"/application/components","status":"valid","level":"6","children":[],"hasParent":true}],"hasParent":true},{"sys_id":"33d064cc47f12150fd6ce977746d4375","type":"sn_cdm_node_cdi","main_id":"111687","name":"dbIpAddress","node_path":"!K<+!K<,!K<9!K<;!K<<!K<A","value":"10.20.40.50","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A","main_id_encoded":"K<A","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"f7d064cc47f12150fd6ce977746d4375","type":"sn_cdm_node_cdi","main_id":"111688","name":"dbName","node_path":"!K<+!K<,!K<9!K<;!K<<!K<B","value":"paymentX_dev2","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B","main_id_encoded":"K<B","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"77d064cc47f12150fd6ce977746d4376","type":"sn_cdm_node_cdi","main_id":"111690","name":"dbPort","node_path":"!K<+!K<,!K<9!K<;!K<<!K<D","value":"8050","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D","main_id_encoded":"K<D","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"3fd064cc47f12150fd6ce977746d4376","type":"sn_cdm_node_cdi","main_id":"111691","name":"dbServer","node_path":"!K<+!K<,!K<9!K<;!K<<!K<E","value":"db22.paymentx.be","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E","main_id_encoded":"K<E","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"f3d064cc47f12150fd6ce977746d4377","type":"sn_cdm_node_cdi","main_id":"111692","name":"dbUserName","node_path":"!K<+!K<,!K<9!K<;!K<<!K<F","value":"root","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F","main_id_encoded":"K<F","node_classifier":"/application/components","status":"valid","level":"5","children":[],"hasParent":true},{"sys_id":"c4f1a40047352150fd6ce977746d43dd","type":"sn_cdm_node_cdi","main_id":"111700","name":"dbPassword","node_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N","secure_value":"﷞﷟﷒dac329a2476c6110fd6ce977746d43e1﷬﷔1﷬﷭w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=﷮﷯","effective_path":"!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N","main_id_encoded":"K<N","node_classifier":"/application/deployables/env:Development","status":"valid","level":"7","masked_value":"*******","children":[],"hasParent":true}],"hasParent":true}],"hasParent":true}],"hasParent":true}],"hasParent":true}]}
    

    다음 코드 예제에서는 getTree() 메서드를 호출하여 계층적 키-값 쌍의 간단한 JSON 객체를 반환하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("9f12a80047352150fd6ce977746d4364")
      .query()
      .getTree(true, true);
    
    gs.info(JSON.stringify(primarySnapshot));

    반환 결과:

    {
      "Development_1": {
        "vars": {},
        "services": {
          "vars": {},
          "paymentComponent": {
            "applicationSLA": "24x7",
            "paymentService": {
              "database": {
                "backup": {
                  "dbServer": "db23.paymentx.be"
                },
                "dbIpAddress": "10.20.40.50",
                "dbName": "paymentX_dev2",
                "dbPort": "8050",
                "dbServer": "db22.paymentx.be",
                "dbUserName": "root",
                "dbPassword": "*******"
              }
            }
          }
        }
      }
    }

    다음 코드 예제에서는 getTree() 메서드를 호출하여 노드 메타데이터와 모든 하위 노드를 포함하는 JSON 객체를 반환하는 방법을 보여 줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
      .snapshotId("9f12a80047352150fd6ce977746d4364")
      .query()
      .getTree(false, true);
    
    gs.info(JSON.stringify(primarySnapshot));

    반환 결과:

    {
      "sys_id": "62a0a0cc47f12150fd6ce977746d431a",
      "type": "sn_cdm_node_deployable",
      "main_id": "111673",
      "name": "Development_1",
      "node_path": "!K<+!K<0!K<1",
      "effective_path": "!K<+!K<0!K<1",
      "main_id_encoded": "K<1",
      "node_classifier": "/application/deployables/env:Development",
      "status": "valid",
      "level": "2",
      "children": [
        {
          "sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
          "type": "sn_cdm_node_folder",
          "main_id": "111674",
          "name": "vars",
          "node_path": "!K<+!K<0!K<1!K<2",
          "effective_path": "!K<+!K<0!K<1!K<2",
          "main_id_encoded": "K<2",
          "node_classifier": "/application/deployables/env:Development/vars",
          "status": "valid",
          "level": "3",
          "children": [],
          "hasParent": true
        },
        {
          "sys_id": "2ca1600047352150fd6ce977746d4391",
          "type": "sn_cdm_node_linked",
          "main_id": "111693",
          "name": "services",
          "node_path": "!K<+!K<0!K<1!K<G",
          "effective_path": "!K<+!K<0!K<1!K<G",
          "main_id_encoded": "K<G",
          "node_classifier": "/application/deployables/env:Development",
          "status": "valid",
          "level": "3",
          "children": [
            {
              "sys_id": "2bb0e0cc47f12150fd6ce977746d43e2",
              "type": "sn_cdm_node_folder",
              "main_id": "111680",
              "name": "vars",
              "node_path": "!K<+!K</!K<7!K<8",
              "effective_path": "!K<+!K<0!K<1!K<G!K<8",
              "main_id_encoded": "K<8",
              "node_classifier": "/application/collections/vars",
              "status": "valid",
              "level": "3",
              "children": [],
              "hasParent": true
            },
            {
              "sys_id": "ccf1640047352150fd6ce977746d438b",
              "type": "sn_cdm_node_component",
              "main_id": "111697",
              "name": "paymentComponent",
              "node_path": "!K<+!K<0!K<1!K<G!K<K",
              "effective_path": "!K<+!K<0!K<1!K<G!K<K",
              "main_id_encoded": "K<K",
              "node_classifier": "/application/deployables/env:Development",
              "status": "valid",
              "level": "4",
              "children": [
                {
                  "sys_id": "7fd064cc47f12150fd6ce977746d4372",
                  "type": "sn_cdm_node_cdi",
                  "main_id": "111682",
                  "name": "applicationSLA",
                  "node_path": "!K<+!K<,!K<9!K<:",
                  "value": "24x7",
                  "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<:",
                  "main_id_encoded": "K<:",
                  "node_classifier": "/application/components",
                  "status": "valid",
                  "level": "3",
                  "children": [],
                  "hasParent": true
                },
                {
                  "sys_id": "44f1a40047352150fd6ce977746d43dc",
                  "type": "sn_cdm_node_component",
                  "main_id": "111698",
                  "name": "paymentService",
                  "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L",
                  "main_id_encoded": "K<L",
                  "node_classifier": "/application/deployables/env:Development",
                  "status": "valid",
                  "level": "5",
                  "children": [
                    {
                      "sys_id": "8cf1a40047352150fd6ce977746d43dc",
                      "type": "sn_cdm_node_component",
                      "main_id": "111699",
                      "name": "database",
                      "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M",
                      "main_id_encoded": "K<M",
                      "node_classifier": "/application/deployables/env:Development",
                      "status": "valid",
                      "level": "6",
                      "children": [
                        {
                          "sys_id": "b3d064cc47f12150fd6ce977746d4374",
                          "type": "sn_cdm_node_component",
                          "main_id": "111685",
                          "name": "backup",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<?",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?",
                          "main_id_encoded": "K<?",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [
                            {
                              "sys_id": "7bd064cc47f12150fd6ce977746d4374",
                              "type": "sn_cdm_node_cdi",
                              "main_id": "111686",
                              "name": "dbServer",
                              "node_path": "!K<+!K<,!K<9!K<;!K<<!K<?!K<@",
                              "value": "db23.paymentx.be",
                              "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<?!K<@",
                              "main_id_encoded": "K<@",
                              "node_classifier": "/application/components",
                              "status": "valid",
                              "level": "6",
                              "children": [],
                              "hasParent": true
                            }
                          ],
                          "hasParent": true
                        },
                        {
                          "sys_id": "33d064cc47f12150fd6ce977746d4375",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111687",
                          "name": "dbIpAddress",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<A",
                          "value": "10.20.40.50",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<A",
                          "main_id_encoded": "K<A",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "f7d064cc47f12150fd6ce977746d4375",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111688",
                          "name": "dbName",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<B",
                          "value": "paymentX_dev2",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<B",
                          "main_id_encoded": "K<B",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "77d064cc47f12150fd6ce977746d4376",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111690",
                          "name": "dbPort",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<D",
                          "value": "8050",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<D",
                          "main_id_encoded": "K<D",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "3fd064cc47f12150fd6ce977746d4376",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111691",
                          "name": "dbServer",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<E",
                          "value": "db22.paymentx.be",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<E",
                          "main_id_encoded": "K<E",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "f3d064cc47f12150fd6ce977746d4377",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111692",
                          "name": "dbUserName",
                          "node_path": "!K<+!K<,!K<9!K<;!K<<!K<F",
                          "value": "root",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<F",
                          "main_id_encoded": "K<F",
                          "node_classifier": "/application/components",
                          "status": "valid",
                          "level": "5",
                          "children": [],
                          "hasParent": true
                        },
                        {
                          "sys_id": "c4f1a40047352150fd6ce977746d43dd",
                          "type": "sn_cdm_node_cdi",
                          "main_id": "111700",
                          "name": "dbPassword",
                          "node_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "secure_value": "﷞﷟﷒dac329a2476c6110fd6ce977746d43e1﷬﷔1﷬﷭w8YJ85PO5byT5YNmeG_HwQ==WrNQP39n-PWKFs_VXFSjr3TJsGxS1ESKpyl4PUE=﷮﷯",
                          "effective_path": "!K<+!K<0!K<1!K<G!K<K!K<L!K<M!K<N",
                          "main_id_encoded": "K<N",
                          "node_classifier": "/application/deployables/env:Development",
                          "status": "valid",
                          "level": "7",
                          "masked_value": "*******",
                          "children": [],
                          "hasParent": true
                        }
                      ],
                      "hasParent": true
                    }
                  ],
                  "hasParent": true
                }
              ],
              "hasParent": true
            }
          ],
          "hasParent": true
        }
      ]
    }

    CdmQuery - getValue(문자열 필드 이름)

    현재 반복된 노드 결과의 지정된 필드 값을 반환합니다.

    표 10. 매개변수
    이름 유형 설명
    fieldName 문자열 반환할 스냅샷 기록이 있는 필드의 이름입니다.
    표 11. 반환
    유형 설명
    없음

    다음 코드 예제에서는 getValue() 메서드를 사용하여 필요한 데이터를 추출하는 방법을 보여 줍니다.

    var cdmQuery = new sn_cdm.CdmQuery()
      .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
      .decryptPassword(true)
      .query();  
    
    var output = [];
      while(cdmQuery.next()) {
        var name = cdmQuery.getValue('name');
        var type = cdmQuery.getValue('type');
    
        if (type == 'sg_cdm_node_cdi' || type == 'sg_cdm_node_variable') {
          var value = cdmQuery.getValue('value');
          output.push(gs.getMessage("{0} : {1} [{2}]", [name, value, type]));
        } else {
          output.push(gs.getMessage("{0} [{1}]", [name, type]));
      }
    } 

    반환 값:

    [
      "test_login_service [sg_cdm_node_deployable]",
      "vars [sg_cdm_node_folder]",
      "service_password : service12345 [sg_cdm_node_variable]",
      "login_service [sg_cdm_node_linked]",
      "vars [sg_cdm_node_folder]",
      "core_component [sg_cdm_node_component]",
      "user_name : admin [sg_cdm_node_cdi]",
      "user_password : service12345 [sg_cdm_node_cdi]"
    ]

    CdmQuery - includeFileMetadata()

    파일 노드에 대한 파일 메타데이터 정보를 가져올지 여부를 지정할 수 있습니다. 파일 메타데이터에는 attachment_id, file_name, content_type 및 체크섬이 포함됩니다.

    주:
    메타데이터는 단순하지 않은 트리에 대해서만 반환됩니다. 이러한 유형의 데이터 반환에 대한 자세한 내용은 다음 문서를 참조하십시오 CdmQuery - getTree(부울 simpleTree, 부울 prettify).
    표 12. 매개변수
    이름 유형 설명
    없음
    표 13. 반환
    유형 설명
    없음

    다음 코드 예제에서는 CdmQuery() API를 호출하고 파일 메타데이터 정보를 반환하는 방법을 보여 줍니다.

    var cdmQuery = new CdmQuery()
    .snapshotId("20c365a2476c6110fd6ce977746d4336")
    .includeFileMetadata()
    .query()
    .getTree(false, true);

    반환:

    {
      "sys_id": "62a0a0cc47f12150fd6ce977746d431a",
      "type": "sn_cdm_node_deployable",
      "main_id": "111673",
      "name": "Development_1",
      "node_path": "!K<+!K<0!K<1",
      "effective_path": "!K<+!K<0!K<1",
      "main_id_encoded": "K<1",
      "node_classifier": "/application/deployables/env:Development",
      "status": "valid",
      "level": "2",
      "children": [
        {
          "sys_id": "2aa0a0cc47f12150fd6ce977746d431a",
          "type": "sn_cdm_node_folder",
          "main_id": "111674",
          "name": "vars",
          "node_path": "!K<+!K<0!K<1!K<2",
          "effective_path": "!K<+!K<0!K<1!K<2",
          "main_id_encoded": "K<2",
          "node_classifier": "/application/deployables/env:Development/vars",
          "status": "valid",
          "level": "3",
          "children": [],
          "hasParent": true
        },
        {
          "sys_id": "b83eb65fffdf6110f0ccffffffffff7d",
          "type": "sn_cdm_node_file",
          "main_id": "111675",
          "name": "deploy_config.xml",
          "node_path": "!K<+!K<0!K<1!K<G",
          "value": "file: http://instance.servicenow.com/sys_attachment.do?sys_id=bc3eb65fffdf6110f0ccffffffffff7d",
          "effective_path": "!K<+!K<0!K<1!K<G",
          "main_id_encoded": "V",
          "node_classifier": "/application/deployables/env:Development",
          "status": "valid",
          "level": "3",
          "file_metadata": {
            "attachment_id": "bc3eb65fffdf6110f0ccffffffffff7d",
            "file_name": "deploy_config.xml",
            "content_type": "application/xml",
            "checksum": "UbWkF5HZOQTQ89bFrqyFBg=="
          },
          "children": [],
          "hasParent": true
        }
      ]
    }

    CdmQuery - 다음()

    다음 노드 결과를 반복하고 있는 경우 반환합니다.

    표 14. 매개변수
    이름 유형 설명
    없음
    표 15. 반환
    유형 설명
    Cdm쿼리 사용 가능한 경우 다음 노드의 CdmQuery 객체입니다.

    사용할 수 있는 추가 노드가 없으면 null 또는 undefined를 반환합니다.

    다음 코드 예제는 next() 메서드가 사용 가능한 노드를 반복하는 방법을 보여줍니다.

    var cdmQuery = new sn_cdm.CdmQuery()
      .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
      .decryptPassword(true)
      .query(); 
    
    var output = [];
    while(cdmQuery.next()) {
      var name = cdmQuery.getValue('name');
      var type = cdmQuery.getValue('type');
        if (type == 'sg_cdm_node_cdi' || type == 'sg_cdm_node_variable') {
          var value = cdmQuery.getValue('value');
          output.push(gs.getMessage("{0} : {1} [{2}]", [name, value, type]));
      } else {
        output.push(gs.getMessage("{0} [{1}]", [name, type]));
      }	 
    } 

    반환 결과:

    [
      "test_login_service [sg_cdm_node_deployable]",
      "vars [sg_cdm_node_folder]",
      "service_password : service12345 [sg_cdm_node_variable]",
      "login_service [sg_cdm_node_linked]",
      "vars [sg_cdm_node_folder]",
      "core_component [sg_cdm_node_component]",
      "user_name : username [sg_cdm_node_cdi]",
      "user_password : service12345 [sg_cdm_node_cdi]" 
    ]

    CdmQuery - 쿼리()

    설정, 항목 노드 및 필터 설정에 따라 데이터베이스 또는 캐시에 대해 CDM 지정된 쿼리를 실행합니다.

    표 16. 매개변수
    이름 유형 설명
    없음
    표 17. 반환
    유형 설명
    Cdm쿼리 CdmQuery 객체입니다.

    다음 코드 예제에서는 CdmQuery() API를 호출하고 쿼리할 배포 가능한 스냅샷을 지정하는 방법을 보여줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
    .decryptPassword(true)
    .query()
    .getTree();

    반환 결과:

    { 
      "_decryptPassword": true,
      "sys_id": "d73d6666c3a27010cc0a259d7640dde7",
      "type": "sg_cdm_node_deployable",
      "main_id": "731",
      "name": "test_login_service",
      "node_path": "!1+!1/!10",
      "effective_path": "!1+!1/!10",
      "main_id_encoded": "10",
      "node_classifier": "/application/deployables/dep:test_login_service", 
      "status": "valid", 
      "children": [
        {
          "_decryptPassword": true,
          "sys_id": "9f3d6666c3a27010cc0a259d7640dde7",
          "type": "sg_cdm_node_folder",
          "main_id": "732",
          "name": "vars",
          "node_path": "!1+!1/!10!11",
          "effective_path": "!1+!1/!10!11",
          "main_id_encoded": "11",
          "node_classifier": "/application/deployables/dep:test_login_service/vars",
          "status": "valid",
          "children": [
            {
              "_decryptPassword": true,
              "sys_id": "49dd2e66c3a27010cc0a259d7640ddf9",
              "type": "sg_cdm_node_variable", 
              "main_id": "741",
              "name": "service_password",
              "node_path": "!1+!1/!10!11!1:",
              "value": "service12345",
              "effective_path": "!1+!1/!10!11!1:",
              "main_id_encoded": "1:",
              "node_classifier": "/application/deployables/dep:test_login_service/vars",
              "status": "valid",
              "children": [],
              "hasParent": true 
            }
          ], 
          "hasParent": true 
        }, 
        {
          "_decryptPassword": true,
          "sys_id": "26bd2e66c3a27010cc0a259d7640dd74",
          "type": "sg_cdm_node_linked",
          "main_id": "740",
          "name": "login_service",
          "node_path": "!1+!1/!10!19",
          "effective_path": "!1+!1/!10!19",
          "main_id_encoded": "19",
          "node_classifier": "/application/deployables/dep:test_login_service",
          "status": "valid",
          "children": [
            {
              "_decryptPassword": true,
              "sys_id": "eeadea66c3a27010cc0a259d7640dd8c",
              "type": "sg_cdm_node_folder",
              "main_id": "738",
              "name": "vars",
              "node_path": "!1+!1.!16!17",
              "effective_path": "!1+!1/!10!19!17",
              "main_id_encoded": "17",
              "node_classifier": "/application/collections/vars",
              "status": "valid",
              "children": [],
              "hasParent": true 
            },
            { 
              "_decryptPassword": true,
              "sys_id": "da1f22e6c3a27010cc0a259d7640dda2",
              "type": "sg_cdm_node_component",
              "main_id": "742",
              "name": "core_component",
              "node_path": "!1+!1/!10!19!1;",
              "effective_path": "!1+!1/!10!19!1;",
              "main_id_encoded": "1;",
              "node_classifier": "/application/deployables/dep:test_login_service",
              "status": "valid",
              "children": [
                { 
                  "_decryptPassword": true,
                  "sys_id": "921f22e6c3a27010cc0a259d7640dda3",
                  "type": "sg_cdm_node_cdi",
                  "main_id": "743",
                  "name": "user_name",
                  "node_path": "!1+!1/!10!19!1;!1<",
                  "value": "admin",
                  "effective_path": "!1+!1/!10!19!1;!1<",
                  "main_id_encoded": "1<",
                  "node_classifier": "/application/deployables/dep:test_login_service",
                  "status": "valid",
                  "children": [],
                  "hasParent": true
                },
                { 
                  "_decryptPassword": true,
                  "sys_id": "5a1f22e6c3a27010cc0a259d7640dda3",
                  "type": "sg_cdm_node_cdi",
                  "main_id": "744",
                  "name": "user_password",
                  "node_path": "!1+!1/!10!19!1;!1?",
                  "value": "service12345",
                  "effective_path": "!1+!1/!10!19!1;!1?",
                  "main_id_encoded": "1?",
                  "node_classifier": "/application/deployables/dep:test_login_service",
                  "status": "valid",
                  "children": [],
                  "hasParent": true
                }
              ],
              "hasParent": true
            }
          ],
          "hasParent": true
        }
      ],
      "hasParent": false
    }

    CdmQuery - snapshotId(문자열 snapshotSysID)

    항목 노드를 지정합니다. CdmQuery API는 쿼리를 항목 노드와 해당 하위 노드로 제한합니다. 이 메서드를 호출해야 합니다.

    표 18. 매개변수
    이름 유형 설명
    **스냅샷SysId** 문자열 쿼리할 배포 가능 스냅샷의 Sys_id입니다.

    내부적으로 변경 세트의 sys_id과 배포 가능한 노드의 sys_id 설정합니다.

    테이블: CDM 스냅샷 [sn_cdm_snapshot]

    표 19. 반환
    유형 설명
    없음

    다음 코드 예제에서는 CdmQuery() API를 호출하고 쿼리할 배포 가능한 스냅샷을 지정하는 방법을 보여줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
    .decryptPassword(true)
    .query()
    .getTree();

    반환 결과:

    { 
      "_decryptPassword": true,
      "sys_id": "d73d6666c3a27010cc0a259d7640dde7",
      "type": "sg_cdm_node_deployable",
      "main_id": "731",
      "name": "test_login_service",
      "node_path": "!1+!1/!10",
      "effective_path": "!1+!1/!10",
      "main_id_encoded": "10",
      "node_classifier": "/application/deployables/dep:test_login_service", 
      "status": "valid", 
      "children": [
        {
          "_decryptPassword": true,
          "sys_id": "9f3d6666c3a27010cc0a259d7640dde7",
          "type": "sg_cdm_node_folder",
          "main_id": "732",
          "name": "vars",
          "node_path": "!1+!1/!10!11",
          "effective_path": "!1+!1/!10!11",
          "main_id_encoded": "11",
          "node_classifier": "/application/deployables/dep:test_login_service/vars",
          "status": "valid",
          "children": [
            {
              "_decryptPassword": true,
              "sys_id": "49dd2e66c3a27010cc0a259d7640ddf9",
              "type": "sg_cdm_node_variable", 
              "main_id": "741",
              "name": "service_password",
              "node_path": "!1+!1/!10!11!1:",
              "value": "service12345",
              "effective_path": "!1+!1/!10!11!1:",
              "main_id_encoded": "1:",
              "node_classifier": "/application/deployables/dep:test_login_service/vars",
              "status": "valid",
              "children": [],
              "hasParent": true 
            }
          ], 
          "hasParent": true 
        }, 
        {
          "_decryptPassword": true,
          "sys_id": "26bd2e66c3a27010cc0a259d7640dd74",
          "type": "sg_cdm_node_linked",
          "main_id": "740",
          "name": "login_service",
          "node_path": "!1+!1/!10!19",
          "effective_path": "!1+!1/!10!19",
          "main_id_encoded": "19",
          "node_classifier": "/application/deployables/dep:test_login_service",
          "status": "valid",
          "children": [
            {
              "_decryptPassword": true,
              "sys_id": "eeadea66c3a27010cc0a259d7640dd8c",
              "type": "sg_cdm_node_folder",
              "main_id": "738",
              "name": "vars",
              "node_path": "!1+!1.!16!17",
              "effective_path": "!1+!1/!10!19!17",
              "main_id_encoded": "17",
              "node_classifier": "/application/collections/vars",
              "status": "valid",
              "children": [],
              "hasParent": true 
            },
            { 
              "_decryptPassword": true,
              "sys_id": "da1f22e6c3a27010cc0a259d7640dda2",
              "type": "sg_cdm_node_component",
              "main_id": "742",
              "name": "core_component",
              "node_path": "!1+!1/!10!19!1;",
              "effective_path": "!1+!1/!10!19!1;",
              "main_id_encoded": "1;",
              "node_classifier": "/application/deployables/dep:test_login_service",
              "status": "valid",
              "children": [
                { 
                  "_decryptPassword": true,
                  "sys_id": "921f22e6c3a27010cc0a259d7640dda3",
                  "type": "sg_cdm_node_cdi",
                  "main_id": "743",
                  "name": "user_name",
                  "node_path": "!1+!1/!10!19!1;!1<",
                  "value": "admin",
                  "effective_path": "!1+!1/!10!19!1;!1<",
                  "main_id_encoded": "1<",
                  "node_classifier": "/application/deployables/dep:test_login_service",
                  "status": "valid",
                  "children": [],
                  "hasParent": true
                },
                { 
                  "_decryptPassword": true,
                  "sys_id": "5a1f22e6c3a27010cc0a259d7640dda3",
                  "type": "sg_cdm_node_cdi",
                  "main_id": "744",
                  "name": "user_password",
                  "node_path": "!1+!1/!10!19!1;!1?",
                  "value": "service12345",
                  "effective_path": "!1+!1/!10!19!1;!1?",
                  "main_id_encoded": "1?",
                  "node_classifier": "/application/deployables/dep:test_login_service",
                  "status": "valid",
                  "children": [],
                  "hasParent": true
                }
              ],
              "hasParent": true
            }
          ],
          "hasParent": true
        }
      ],
      "hasParent": false
    }

    CdmQuery - substituteVariable(부울 대체)

    CDI(구성 데이터 항목) 노드의 변수 참조를 참조된 변수 노드의 값으로 대체할지 여부를 지정할 수 있습니다.

    표 20. 매개변수
    이름 유형 설명
    대용하다 부울 옵션입니다. CDI 노드의 변수 참조를 참조된 변수 노드의 값으로 대체할지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: CDI 노드의 변수 참조를 참조된 변수 노드의 값으로 대체합니다.
    • false: CDI 노드의 변수 참조를 참조된 변수 노드의 값으로 대체하지 않습니다.

    기본값: true

    표 21. 반환
    유형 설명
    없음

    다음 코드 예제는 CDI 노드에서 변수 참조의 대체를 해제하는 방법을 보여줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("20c365a2476c6110fd6ce977746d4336")
    .substituteVariable(false)
    .query()
    .getTree(true, true);
    
    gs.info(primarySnapshot);

    반환 결과 예시:

    {
      "paymentService-V1.1": {
        "featureToggles": {
          "paymentRefund": "enabled",
          "myPreferredPaymentMethods": "enabled",
          "invoicePrinting": "enabled",
          "payOnDelivery": "disabled",
          "payByVoucher": "enabled"
        },
        "vars": {
          "paymentService": {
            "database": {
              "dbName": "paymentX_dev2",
              "dbUserName": "root",
              "dbPassword": "admin123",
              "dbServer": "db22.paymentx.be",
              "dbPort": "8050",
              "dbIpAddress": "10.20.40.50",
              "backup": {
                "dbServer": "db23.paymentx.be"
              }
            }
          },
          "applicationSLA": "24x7"
        },
        "settings": {
          "merchantId": "10334",
          "paymentMethods": "1,3,5,6",
          "allowed.billing.countries": "74,76,88,136,139,176,197",
          "creditcards.cacf.type.ids": "43,44,45,46,48,49,50",
          "creditcards.oney.type.ids": "33,34,35",
          "included.availabilityids": "999",
          "included.warrantiestypeids.cacf": "19002,19005,19006,19009,19010,19011,19014,19016",
          "dbIPAddress": "@@paymentService/database/dbIpAddress@@",
          "dbPort": "@@paymentService/database/dbPort@@",
          "dbConnectionString": "@@paymentService/database/dbUserName@@:@@paymentService/database/dbPassword@@ @@paymentService/database/dbServer@@:@@paymentService/database/dbPort@@ @@paymentService/database/dbName@@",
          "dbConnectionStringBackup": "@@paymentService/database/dbUserName@@:@@paymentService/database/dbPassword@@ @@paymentService/database/backup/dbServer@@ @@paymentService/database/dbName@@",
          "paypal": "enabled",
          "applePay": "disabled",
          "ogone": "enabled"
        }
      }
    }

    다음 코드 예제에서는 CDI 노드에서 변수 참조의 대체를 켜고 동일한 레코드에 대한 관련 반환 결과를 켜는 방법을 보여줍니다.

    var primarySnapshot = new sn_cdm.CdmQuery()
    .snapshotId("20c365a2476c6110fd6ce977746d4336")
    .substituteVariable(true)
    .query()
    .getTree(false, true);
    
    gs.info(primarySnapshot);

    반환 결과 예시:

    {
      "paymentService-V1.1": {
        "featureToggles": {
          "paymentRefund": "enabled",
          "myPreferredPaymentMethods": "enabled",
          "invoicePrinting": "enabled",
          "payOnDelivery": "disabled",
          "payByVoucher": "enabled"
        },
        "vars": {
          "paymentService": {
            "database": {
              "dbName": "paymentX_dev2",
              "dbUserName": "root",
              "dbPassword": "admin123",
              "dbServer": "db22.paymentx.be",
              "dbPort": "8050",
              "dbIpAddress": "10.20.40.50",
              "backup": {
                "dbServer": "db23.paymentx.be"
              }
            }
          },
          "applicationSLA": "24x7"
        },
        "settings": {
          "merchantId": "10334",
          "paymentMethods": "1,3,5,6",
          "allowed.billing.countries": "74,76,88,136,139,176,197",
          "creditcards.cacf.type.ids": "43,44,45,46,48,49,50",
          "creditcards.oney.type.ids": "33,34,35",
          "included.availabilityids": "999",
          "included.warrantiestypeids.cacf": "19002,19005,19006,19009,19010,19011,19014,19016",
          "dbIPAddress": "10.20.40.50",
          "dbPort": "8050",
          "dbConnectionString": "root:admin123 db22.paymentx.be:8050 paymentX_dev2",
          "dbConnectionStringBackup": "root:admin123 db23.paymentx.be paymentX_dev2",
          "paypal": "enabled",
          "applePay": "disabled",
          "ogone": "enabled"
        }
      }
    }

    CdmQuery - useCache(불리언 useCache)

    데이터베이스를 쿼리하는 대신 캐시에서 데이터를 검색할지 여부를 지정할 수 있습니다.

    표 22. 매개변수
    이름 유형 설명
    useCache 부울 옵션입니다. 데이터베이스를 쿼리하는 대신 캐시에서 데이터를 검색할지 여부를 나타내는 플래그입니다.
    유효한 값은 다음과 같습니다.
    • true: 캐시에서 데이터를 검색합니다.
    • false: 데이터베이스를 쿼리하여 데이터를 검색합니다.

    기본값: true

    표 23. 반환
    유형 설명
    없음

    다음 코드 예제에서는 캐시를 사용하여 데이터를 가져오는 방법을 보여 줍니다.

    var cdmQuery = new sn_cdm.CdmQuery()
      .snapshotId("1a2fe2e6c3a27010cc0a259d7640dd59")
      .decryptPassword(true)
      .useCache(false)
      .query();