Terraform のplan の結果が出力される # aws_api_gateway_deployment.root will be created + resource "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
取得したツイート情報を保持するデータクラス data class Tweet(val id: Long, val time: LocalDateTime, val text: String) Twitter API のレスポンスからこのクラスに変換して保持する ツイートのID 、ツイートした時間、ツイートの本文を保持
fun putTweetList(accountName: String, since: String, until: String) { val query = 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) } }
fun getTweetListByMonthDay(month: Int, day: Int): Map> { val twitterUser = twitterClient.showUser("account_name") val startYear = LocalDateTime.ofInstant(twitterUser.createdAt.toInstant(), ZoneId.systemDefault()).year val currentYear = LocalDateTime.now().year
Twitter API から showUser 関数でアカウントのの情報を取得 アカウントの作成日時から開始した年を、現在日時から現在の年を取得 開始した年から現在の年までのツイートを取得するのに使用する ` `