`boundary search` — 캐시 검색

boundary search — 캐시 검색

search 명령어는 Boundary의 로컬 캐시에서 세션(session)과 대상(target)에 대한 정보를 검색할 때 사용해요. 자세한 내용은 Boundary의 list와 search 비교 문서를 참고하세요.

출처: HashiCorp Boundary docs

본문

예시

아래 예시는 로컬 캐시에서 이름에 단어 "Generated"가 포함된 모든 TCP 대상을 검색해요.

$ boundary search -resource targets -query 'type="tcp" and name%"Generated"'

예시 출력:

Target information:

  ID:                  ttcp_0987654321
    Scope ID:          p_1234567890
    Version:           2
    Type:              tcp
    Name:              Generated target using host sources
    Description:       Provides a target using host sources in Boundary
    Authorized Actions:
      no-op
      read
      update
      delete
      add-host-sources
      set-host-sources
      remove-host-sources
      add-credential-sources
      set-credential-sources
      remove-credential-sources
      authorize-session

  ID:                  ttcp_1234567890
    Scope ID:          p_1234567890
    Version:           1
    Type:              tcp
    Name:              Generated target with a direct address
    Description:       Provides an initial target using an address in Boundary
    Address:           127.8.0.1
    Authorized Actions:
      no-op
      read
      update
      delete
      add-host-sources
      set-host-sources
      remove-host-sources
      add-credential-sources
      set-credential-sources
      remove-credential-sources
      authorize-session

사용법

$ boundary search [options]

명령어 옵션 (Command options)

  • -filter=<string> (선택) — 설정하면 응답의 각 항목에 대해 필터가 동작해요. 필터에는 큰따옴표가 포함되므로 작은따옴표를 사용할 것을 권장해요. 자세한 내용은 'Filtering and listing resources' 문서를 참고하세요.
  • -max-result-set-size=<int> — 반환할 최대 결과 수를 지정해요. 제한을 없애려면 -1로 설정하세요.
  • -query=<string> (선택) — 설정하면 지정한 자원의 색인된 필드를 검색하는 데 사용할 MQL 쿼리를 지정해요. -query 값을 제공하지 않으면 검색은 캐시된 지정 유형의 모든 자원을 목록으로 보여줘요. 각 자원의 검색 쿼리에 사용할 수 있는 필드는 다음과 같아요.
    • targets: id, name, description, type, address, scope_id
    • sessions: id, type, endpoint, status, scope_id, target_id, user_id
  • -resource=<string> — 캐시에서 검색할 자원의 유형. 필수 필드예요. 다음 유형을 검색할 수 있어요.
    • sessions — 사용자와 연결된 모든 세션을 검색.
    • targets — 사용자와 연결된 모든 대상을 검색.
  • -sort-by=<string> (선택) — 설정하면 검색 결과를 정렬할 기준 열을 지정해요. 다음을 구성할 수 있어요.
    • created_time — 세션을 정렬.
    • name — 대상을 정렬.
  • -sort-direction=<string> (선택) — 설정하면 검색 결과를 정렬할 방향을 지정해요.
    • asc — 오름차순 정렬.
    • desc — 내림차순 정렬.
    • sort-by 플래그는 정렬 방향을 지정하려면 필수예요. 기본적으로 Boundary는 검색 결과를 오름차순으로 정렬해요.

CLI 옵션 — 이 명령어 고유 옵션 외에도 모든 CLI 명령어·하위 명령어에 공통으로 적용되는 옵션들이 있어요. 연결(Connection) 옵션, 클라이언트(Client) 옵션, 출력(Output) 옵션, 환경 변수(Environment variables)를 참고하세요.