본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

레지스트리 토큰 API

원문 보기 위키 갱신

레지스트리 토큰 API 엔드포인트를 이용하면 레지스트리에서 패키지를 설치하고 사용하는 데 필요한 자격 증명인 레지스트리 토큰을 만들고 관리할 수 있어요. 팀원들이 나눠 쓸 토큰을 발급하고 수명을 관리하고 싶을 때 활용하면 좋답니다.

출처: 문서

본문

레지스트리 토큰 생성

curl -H "Authorization: Bearer ***" \
  -X POST "https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/tokens"  \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Usher"
    }'
{
  "id": "0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "graphql_id": "UmVnaXN0cnlUb2tlbi0tLTAxOTFiNmEyLWFhNTEtNzBkMC04YTVmLWFhYmNlMTE1YjBmZA==",
  "description": "Usher",
  "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry/tokens/0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "created_at": "2024-09-03T06:46:39.441Z",
  "created_by": {
    "id": "0191b13b-0eb6-470d-a4c0-2085974f3580",
    "graphql_id": "VXNlci0tLTAxOTFiMTNiLTBlYjYtNDcwZC1hNGMwLTIwODU5NzRmMzU4MA==",
    "name": "Eminem",
    "email": "eminem@buildkite.com",
    "avatar_url": null,
    "created_at": "2024-09-02T05:35:23.318Z"
  },
  "organization": {
    "id": "018a456f-e581-44b6-c5a4-1d8a5f7094ee",
    "slug": "my_great_org",
    "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org",
    "web_url": "https://buildkite.com/organizations/my_great_org"
  },
  "registry": {
    "id": "018f56ef-9ef4-70f0-aba2-0f4578e3d69d",
    "graphql_id": "UmVnaXN0cnktLS0wMThmNTZlZi05ZWY0LTcwZjAtYWJhMi0wZjQ1NzhlM2Q2OWQ=",
    "slug": "my-registry",
    "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry",
    "web_url": "http://buildkite.com/organizations/buildkite/my_great_org/registries/my-registry"
  }
}

필요한 요청 본문 속성:

description 토큰의 설명이에요. 예시: "Usher".

필요한 범위(scope): write_registries

성공 응답: 200 OK

모든 레지스트리 토큰 목록 조회

레지스트리의 토큰 목록을 반환해요.

curl -H "Authorization: Bearer ***" \
  -X GET "https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/tokens" \
  -H "Content-Type: application/json"
[
  {
    "id": "0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
    "graphql_id": "UmVnaXN0cnlUb2tlbi0tLTAxOTFiNmEyLWFhNTEtNzBkMC04YTVmLWFhYmNlMTE1YjBmZA==",
    "description": "Usher",
    "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry/tokens/0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
    "created_at": "2024-09-03T06:46:39.441Z",
    "created_by": {
      "id": "0191b13b-0eb6-470d-a4c0-2085974f3580",
      "graphql_id": "VXNlci0tLTAxOTFiMTNiLTBlYjYtNDcwZC1hNGMwLTIwODU5NzRmMzU4MA==",
      "name": "Eminem",
      "email": "eminem@buildkite.com",
      "avatar_url": null,
      "created_at": "2024-09-02T05:35:23.318Z"
    },
    "organization": {
      "id": "018a456f-e581-44b6-c5a4-1d8a5f7094ee",
      "slug": "my_great_org",
      "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org",
      "web_url": "https://buildkite.com/organizations/my_great_org"
    },
    "registry": {
      "id": "018f56ef-9ef4-70f0-aba2-0f4578e3d69d",
      "graphql_id": "UmVnaXN0cnktLS0wMThmNTZlZi05ZWY0LTcwZjAtYWJhMi0wZjQ1NzhlM2Q2OWQ=",
      "slug": "my-registry",
      "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry",
      "web_url": "http://buildkite.com/organizations/buildkite/my_great_org/registries/my-registry"
    }
  }
]

필요한 범위(scope): read_registries

성공 응답: 200 OK

레지스트리 토큰 조회

단일 레지스트리 토큰의 세부 정보를 반환해요.

curl -H "Authorization: Bearer ***" \
  -X GET "https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/tokens/{id}"
{
  "id": "0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "graphql_id": "UmVnaXN0cnlUb2tlbi0tLTAxOTFiNmEyLWFhNTEtNzBkMC04YTVmLWFhYmNlMTE1YjBmZA==",
  "description": "Usher",
  "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry/tokens/0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "created_at": "2024-09-03T06:46:39.441Z",
  "created_by": {
    "id": "0191b13b-0eb6-470d-a4c0-2085974f3580",
    "graphql_id": "VXNlci0tLTAxOTFiMTNiLTBlYjYtNDcwZC1hNGMwLTIwODU5NzRmMzU4MA==",
    "name": "Eminem",
    "email": "eminem@buildkite.com",
    "avatar_url": null,
    "created_at": "2024-09-02T05:35:23.318Z"
  },
  "organization": {
    "id": "018a456f-e581-44b6-c5a4-1d8a5f7094ee",
    "slug": "my_great_org",
    "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org",
    "web_url": "https://buildkite.com/organizations/my_great_org"
  },
  "registry": {
    "id": "018f56ef-9ef4-70f0-aba2-0f4578e3d69d",
    "graphql_id": "UmVnaXN0cnktLS0wMThmNTZlZi05ZWY0LTcwZjAtYWJhMi0wZjQ1NzhlM2Q2OWQ=",
    "slug": "my-registry",
    "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry",
    "web_url": "http://buildkite.com/organizations/buildkite/my_great_org/registries/my-registry"
  }
}

필요한 범위(scope): read_registries

성공 응답: 200 OK

레지스트리 토큰 수정

curl -H "Authorization: Bearer ***" \
  -X POST "https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/tokens/{id}" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Usher"
    }' 
{
  "id": "0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "graphql_id": "UmVnaXN0cnlUb2tlbi0tLTAxOTFiNmEyLWFhNTEtNzBkMC04YTVmLWFhYmNlMTE1YjBmZA==",
  "description": "Usher",
  "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry/tokens/0191b6a2-aa51-70d0-8a5f-aabce115b0fd",
  "created_at": "2024-09-03T06:46:39.441Z",
  "created_by": {
    "id": "0191b13b-0eb6-470d-a4c0-2085974f3580",
    "graphql_id": "VXNlci0tLTAxOTFiMTNiLTBlYjYtNDcwZC1hNGMwLTIwODU5NzRmMzU4MA==",
    "name": "Eminem",
    "email": "eminem@buildkite.com",
    "avatar_url": null,
    "created_at": "2024-09-02T05:35:23.318Z"
  },
  "organization": {
    "id": "018a456f-e581-44b6-c5a4-1d8a5f7094ee",
    "slug": "my_great_org",
    "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org",
    "web_url": "https://buildkite.com/organizations/my_great_org"
  },
  "registry": {
    "id": "018f56ef-9ef4-70f0-aba2-0f4578e3d69d",
    "graphql_id": "UmVnaXN0cnktLS0wMThmNTZlZi05ZWY0LTcwZjAtYWJhMi0wZjQ1NzhlM2Q2OWQ=",
    "slug": "my-registry",
    "url": "http://api.buildkite.com/v2/packages/organizations/my_great_org/registries/my-registry",
    "web_url": "http://buildkite.com/organizations/buildkite/my_great_org/registries/my-registry"
  }
}

필요한 요청 본문 속성:

description 토큰의 설명이에요. 예시: "Usher".

필요한 범위(scope): write_registries

성공 응답: 200 OK

레지스트리 토큰 삭제

curl -H "Authorization: Bearer ***" \
  -X DELETE "https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/tokens/{id}"

필요한 범위(scope): write_registries

성공 응답: 200 OK

더 알아보기 (Learn more)

이 문서에서는 레지스트리 토큰 API로 토큰을 생성, 목록 조회, 조회, 수정, 삭제하는 방법을 살펴봤어요. 레지스트리 접근 자격 증명을 안전하게 관리하고 싶을 때 유용하답니다. 관련한 자세한 내용은 패키지 레지스트리 개념 문서와 패키지 레지스트리 API 문서에서 이어서 확인해 보세요.