Admin SDK 엔터프라이즈 라이선스 관리자 서비스

Admin SDK 엔터프라이즈 라이선스 관리자 서비스를 사용하면 Apps Script에서 Admin SDK Enterprise License Manager API를 사용할 수 있습니다. 이 API를 사용하면 도메인 관리자가 사용자 라이선스를 할당, 업데이트, 검색, 삭제할 수 있습니다.

참조

이 서비스에 대한 자세한 내용은 Admin SDK Enterprise License Manager API의 참조 문서를 확인하세요. Apps Script의 모든 고급 서비스와 마찬가지로 Admin SDK 엔터프라이즈 라이선스 관리자 서비스는 공개 API와 동일한 객체, 메서드, 매개변수를 사용합니다. 자세한 내용은 메서드 서명 확인 방법을 참조하세요.

문제를 신고하고 다른 지원을 받으려면 Admin SDK 엔터프라이즈 라이선스 관리자 지원 가이드를 참조하세요.

샘플 코드

아래 샘플 코드는 API의 버전 1을 사용합니다.

도메인의 라이선스 할당 목록 가져오기

이 샘플은 제품 ID 및 SKU ID가 포함된 도메인 사용자의 라이선스 할당을 로깅합니다. 페이지 토큰을 사용하여 전체 결과 목록에 액세스합니다.

advanced/adminSDK.gs
/**
 * Logs the license assignments, including the product ID and the sku ID, for
 * the users in the domain. Notice the use of page tokens to access the full
 * list of results.
 */
function getLicenseAssignments() {
  const productId = 'Google-Apps';
  const customerId = 'example.com';
  let assignments = [];
  let pageToken = null;
  do {
    const response = AdminLicenseManager.LicenseAssignments.listForProduct(productId, customerId, {
      maxResults: 500,
      pageToken: pageToken
    });
    assignments = assignments.concat(response.items);
    pageToken = response.nextPageToken;
  } while (pageToken);
  // Print the productId and skuId
  for (const assignment of assignments) {
    console.log('userId: %s, productId: %s, skuId: %s',
        assignment.userId, assignment.productId, assignment.skuId);
  }
}

사용자의 라이선스 할당 삽입하기

이 샘플은 지정된 제품 ID와 SKU ID 조합에 대해 사용자에 대한 라이선스 할당을 삽입하는 방법을 보여줍니다.

advanced/adminSDK.gs
/**
 * Insert a license assignment for a user, for a given product ID and sku ID
 * combination.
 * For more details follow the link
 * https://developers.google.com/admin-sdk/licensing/reference/rest/v1/licenseAssignments/insert
 */
function insertLicenseAssignment() {
  const productId = 'Google-Apps';
  const skuId = 'Google-Vault';
  const userId = 'marty@hoverboard.net';
  try {
    const results = AdminLicenseManager.LicenseAssignments
        .insert({userId: userId}, productId, skuId);
    console.log(results);
  } catch (e) {
    // TODO (developer) - Handle exception.
    console.log('Failed with an error %s ', e.message);
  }
}