"aws_api_gateway_deployment" "root" { // ・・・ } # aws_api_gateway_integration.get will be created + resource "aws_api_gateway_integration" "get" { // ・・・ } // ・・・ Plan: 14 to add, 0 to change, 0 to destroy. ------------------------------------------------------------------------ Note: You didn't specify an "-out" parameter to save this plan, so Terraform can't guarantee that exactly these actions will be performed if "terraform apply" is subsequently run. BUILD SUCCESSFUL in 53s
= Query("from:$accountName since:$since until:$until") val queryResults = twitterClient.search(query).tweets val list = queryResults.map { Tweet(it.id, LocalDateTime.ofInstant(it.createdAt.toInstant(), ZoneId.systemDefault()), it.text) } val client = AmazonDynamoDBClientBuilder.defaultClient() list.forEach { val time = it.time val values = mapOf( "id" to AttributeValue().withN(it.id.toString()), "tweet_date" to AttributeValue().withS( TABLE_DATE_FORMAT.format( time.year, time.month.value, time.dayOfMonth ) ), "tweet_time" to AttributeValue().withS(TABLE_TIME_FORMAT.format(time.hour, time.minute, time.second)), "tweet_text" to AttributeValue().withS(it.text) ) val request = PutItemRequest().withItem(values).withTableName("Tweet") client.putItem(request) } }
val TIME_FORMAT = "\"%d-%02d-%02d_%02d:%02d:%02d_JST\"" val accountName = "account_name" val lastDate = LocalDateTime.now(ZoneId.of("Asia/Tokyo")).minusDays(1) val year = lastDate.year val month = lastDate.month.value val day = lastDate.dayOfMonth val since = TIME_FORMAT.format(year, month, day, 0, 0, 0) val until = TIME_FORMAT.format(year, month, day, 23, 59, 59) putTweetList(accountName, since, until) } @Scheduled アノテーションで、AWS のcron 形式で実行条件を指定できる( これは1 日1 回実行される設定) 現在日時の1 日前の年月日を取得( 毎日前日のツイートを収集する想定) Twitter API で必要な文字列形式に変換して、前述の登録処理の関数を実行 ` `