Google Workspace 구독의 수명 주기 이벤트 수신 및 응답

이 페이지에서는 Google Workspace 구독에 대해 수신하는 수명 주기 이벤트와 이벤트를 사용하여 활성 구독을 유지하는 방법을 설명합니다.

Google Workspace Events API는 다음과 같은 유형의 수명 주기 이벤트를 전송합니다.

앱은 이러한 수명 주기 이벤트 유형을 명시적으로 처리하고 향후 표시될 수 있는 새 이벤트 유형을 무시해야 합니다.

Google Workspace Events API의 수명 주기 이벤트는 CloudEvents 사양에 따라 구조화됩니다. 자세한 내용은 Google Workspace 이벤트 구조를 참고하세요.

정지 이벤트

Google Workspace 구독에 오류가 발생하면 Google Workspace Events API는 구독을 정지하고 이벤트 수신을 방지합니다. 구독을 다시 활성화하기 전에 구독 관련 오류를 해결하세요.

정지를 알리기 위해 Google Workspace Events API는 이벤트 유형이 google.workspace.events.subscription.v1.suspended인 수명 주기 이벤트를 전송합니다.

정지 이벤트를 수신한 후 정지 이유를 알아보고 오류를 해결하고 구독을 다시 활성화할 수 있습니다. 자세한 내용은 오류 해결 및 Google Workspace 구독 재활성화를 참고하세요.

다음은 ENDPOINT_PERMISSION_DENIED 오류로 인해 정지된 Google Workspace 구독에 관한 수명 주기 이벤트의 CloudEvent를 보여줍니다.

{
  "id": "EVENT_UUID",
  "source": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "subject": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "type": "google.workspace.events.subscription.v1.suspended",
  "time": "2023-06-08T06:50:43.641299Z",
  "spec_version": '1.0',
  "datacontenttype": "application/json",
  "data": {
    "subscription":{
      "name": "subscriptions/SUBSCRIPTION_ID",
      "suspension_reason": "ENDPOINT_PERMISSION_DENIED",
      ...
    }
  }
}

만료 알림 이벤트

구독이 만료되면 Google Workspace Events API에서 영구적으로 삭제하므로 갱신하거나 다시 활성화할 수 없습니다.

만료되는 구독을 알리기 위해 Google Workspace Events API는 만료 시간 12시간 전과 1시간 전에 수명 주기 이벤트를 전송합니다. 수명 주기 이벤트의 이벤트 유형은 google.workspace.events.subscription.v1.expirationReminder입니다.

만료 알림 이벤트를 수신하면 subscriptions.update() 메서드를 사용하여 만료 시간을 업데이트합니다. 자세한 내용은 Google Workspace 구독 업데이트 또는 갱신하기를 참고하세요.

다음은 만료되는 Google Workspace 구독에 관한 수명 주기 이벤트의 CloudEvent를 보여줍니다.

{
  "id": "EVENT_UUID",
  "source": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "subject": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "type": "google.workspace.events.subscription.v1.expirationReminder",
  "time": "2023-06-08T06:50:43.641299Z",
  "spec_version": '1.0',
  "datacontenttype": "application/json",
  "data": {
    "subscription":{
      "name": "subscriptions/SUBSCRIPTION_ID",
      "expire_time": "2023-06-08T18:50:43.641299Z",
      ...
    }
  }
}

구독 만료 이벤트

구독이 만료되면 Google Workspace Events API에서 수명 주기 이벤트를 전송합니다. 이 수명 주기 이벤트의 이벤트 유형은 google.workspace.events.subscription.v1.expired입니다.

Google Workspace Events API는 만료된 구독을 영구적으로 삭제합니다. 구독이 만료되면 subscriptions.create() 메서드를 사용하여 다른 구독을 만드세요. 자세한 내용은 Google Workspace 구독 만들기를 참고하세요.

다음은 만료된 Google Workspace 구독에 관한 수명 주기 이벤트의 CloudEvent를 보여줍니다.

{
  "id": "EVENT_UUID",
  "source": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "subject": "//workspaceevents.googleapis.com/subscriptions/SUBSCRIPTION_ID",
  "type": "google.workspace.events.subscription.v1.expired",
  "time": "2023-06-08T07:00:00.000000Z",
  "spec_version": '1.0',
  "datacontenttype": "application/json",
  "data": {
    "subscription":{
      "name": "subscriptions/SUBSCRIPTION_ID",
      "expire_time": "2023-06-08T07:00:00.000000Z",
      ...
    }
  }
}