GS2-Timer

Create Client

timer_client = client('timer')

Method

create_timer

response = timer_client:create_timer(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマーを新規作成します

タイマーの timestamp は秒単位で指定できますが、 指定した時刻以降で通常1分以内にコールバックURLは呼び出されます

混雑時などには数分の遅れが出ることがあります

タイマーによるコールバックは指定されたリトライ回数試行します タイムアウトなどの理由により、実際には通信が到達しているにもかかわらず、リトライが発生する可能性があります

コールバックは同等のリクエストが複数回呼び出されても問題なく動作するように設計してください

Request

{
  timerPoolName=string,
  callbackMethod=string,
  executeTime=number,
  retryMax=number,
  callbackBody=string,
  callbackUrl=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。
  • callbackMethod
  • [string] コールバックに利用するHTTPメソッド
  • executeTime
  • [number] コールバックを実行するタイムスタンプ
  • retryMax
  • [number] 最大リトライ回数
  • callbackBody
  • [string] method に PUT/POST を指定したときに利用するリクエストボディ
  • callbackUrl
  • [string] コールバック先のURL

Response

  • item
  • [Timer] タイマー

create_timer_pool

response = timer_client:create_timer_pool(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマープールを新規作成します

Request

{
  name=string,
  description=string,
}
  • name
  • [string] タイマープールの名前
  • description
  • [string] タイマープールの説明

Response

  • item
  • [TimerPool] タイマープール

delete_timer

response = timer_client:delete_timer(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマーを削除します

Request

{
  timerPoolName=string,
  timerId=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。
  • timerId
  • [string] タイマーIDを指定します。

Response

None

delete_timer_pool

response = timer_client:delete_timer_pool(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマープールを削除します

Request

{
  timerPoolName=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。

Response

None

describe_timer

response = timer_client:describe_timer(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマーの一覧を取得します

Request

{
  timerPoolName=string,
  pageToken=string,
  limit=number,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。
  • pageToken
  • [string] データの取得を開始する位置を指定するトークン
  • limit
  • [number] データの取得件数

Response

  • nextPageToken
  • [string] 次のページを読み込むためのトークン
  • items
  • [table<Timer>] タイマー

describe_timer_pool

response = timer_client:describe_timer_pool(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマープールの一覧を取得します

Request

{
  pageToken=string,
  limit=number,
}
  • pageToken
  • [string] データの取得を開始する位置を指定するトークン
  • limit
  • [number] データの取得件数

Response

  • nextPageToken
  • [string] 次のページを読み込むためのトークン
  • items
  • [table<TimerPool>] タイマープール

get_timer

response = timer_client:get_timer(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマーを取得します

Request

{
  timerPoolName=string,
  timerId=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。
  • timerId
  • [string] タイマーのIDを指定します。

Response

  • item
  • [Timer] タイマー

get_timer_pool

response = timer_client:get_timer_pool(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマープールを取得します

Request

{
  timerPoolName=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。

Response

  • item
  • [TimerPool] タイマープール

update_timer_pool

response = timer_client:update_timer_pool(request)
if response.isError then
  -- エラー処理 --
  print(response.statusCode)
  print(response.errorMessage)
else
  -- 正常処理 --
  print(response.result)
end

タイマープールを更新します

Request

{
  timerPoolName=string,
  description=string,
}
  • timerPoolName
  • [string] タイマープールの名前を指定します。
  • description
  • [string] タイマープールの説明

Response

  • item
  • [TimerPool] タイマープール

Model

TimerPool

  • createAt
  • [number] 作成日時(エポック秒)
  • description
  • [string] 説明文
  • name
  • [string] タイマープール名
  • ownerId
  • [string] オーナーID
  • updateAt
  • [number] 最終更新日時(エポック秒)
  • timerPoolId
  • [string] タイマープールGRN

Timer

  • executeTime
  • [number] コールバック時間(エポック秒)
  • retryMax
  • [number] 最大リトライ回数
  • callbackMethod
  • [string] コールバックHTTPメソッド
  • createAt
  • [number] 作成日時(エポック秒)
  • timerPoolId
  • [string] タイマープールGRN
  • ownerId
  • [string] オーナーID
  • timerId
  • [string] タイマーGRN
  • callbackBody
  • [string] コールバックボディ(PUT/POSTのときのみ有効)
  • callbackUrl
  • [string] コールバックURL