{"id":565,"date":"2019-08-01T16:12:00","date_gmt":"2019-08-01T07:12:00","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/08\/01\/serverless-meetup"},"modified":"2019-08-01T16:12:00","modified_gmt":"2019-08-01T07:12:00","slug":"serverless-meetup","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/08\/01\/serverless-meetup\/","title":{"rendered":"Serverless Meetup\u3068\u3044\u3046\u30a4\u30d9\u30f3\u30c8\u3067\u8a71\u3057\u3066\u304d\u305f"},"content":{"rendered":"

Serverless Meetup Tokyo<\/a>\u3068\u3044\u3046\u30a4\u30d9\u30f3\u30c8\u3067\u300cLambda\u3068DynamoDB\u3067IoT\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u958b\u767a<\/a>\u300d\u3092\u30c6\u30fc\u30de\u306b\u30b9\u30d4\u30fc\u30ab\u30fc\u3092\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n

\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u73fe\u5728\u53d6\u308a\u7d44\u3093\u3067\u3044\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u958b\u767a\u30b9\u30bf\u30a4\u30eb\u3092\u7d39\u4ecb\u3057\u305f\u3082\u306e\u3067\u3001\u3044\u308d\u3044\u308d\u3056\u3063\u304f\u3070\u3089\u3093\u306b\u30ea\u30a2\u30eb\u306a\u3068\u3053\u308d\u3092\u8a71\u3059\u3068\u3044\u3046\u306e\u3092\u610f\u8b58\u3057\u307e\u3057\u305f\u3002\u601d\u3063\u305f\u3088\u308a\u300c\u3046\u3061\u3082\u540c\u3058\u3088\u3046\u306a\u3053\u3068\u3067\u60a9\u3093\u3067\u308b\u3093\u3067\u3059\u300d\u307f\u305f\u3044\u306b\u3044\u3063\u3066\u304f\u3060\u3055\u308b\u65b9\u304c\u3044\u3066\u3088\u304b\u3063\u305f\u3067\u3059\u3002<\/p>\n

\u53e3\u982d\u3067\u8a71\u3057\u305f\u3053\u3068\u306a\u3069\u3092\u3053\u3053\u3067\u3082\u5c11\u3057\u88dc\u8db3\u3057\u3066\u304a\u3053\u3046\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

=>\u5b9f\u969b\u306f\u3001\u3053\u308c\u306b\u52a0\u3048\u3066\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3084\u3001IoT Job\u306b\u3088\u308b\u30c7\u30d0\u30a4\u30b9\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3001\u5916\u90e8API\u3068\u306e\u9023\u643a\u306a\u3069\u3001\u3082\u3046\u3061\u3087\u3063\u3068\u8907\u96d1\u3067\u3059\u3002<\/p>\n

\"\"<\/p>\n

=>\u73fe\u72b6\u3060\u3068\u3001DynamoDB\u306fCloudFormation\u3067\u7ba1\u7406\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n

\"\"<\/p>\n

=>\u30b9\u30e9\u30a4\u30c9\u306b\u8f09\u305b\u3089\u308c\u306a\u304b\u3063\u305f\u30b3\u30fc\u30c9\u3092\u5c11\u3057\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n

\u4f8b\u3048\u3070\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u691c\u7d22\u3067\u30d5\u30a3\u30eb\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u3001\u69cb\u9020\u4f53\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

type FilterBuilder struct {\n    Expr []string\n    Arg  []interface{}\n}\n\nfunc (f *FilterBuilder) Op(path string, op Operator, arg interface{}) *FilterBuilder {\n    return f.Append(\n        fmt.Sprintf("'%s' %s ?", path, op),\n        []interface{}{arg},\n    )\n}\n\nfunc (f *FilterBuilder) Equal(path string, arg interface{}) *FilterBuilder {\n    return f.Op(path, EQ, arg)\n}\n\nfunc (f *FilterBuilder) Between(path string, arg1 interface{}, arg2 interface{}) *FilterBuilder {\n    return f.Append(\n        fmt.Sprintf("'%s' BETWEEN ? AND ?", path),\n        []interface{}{arg1, arg2},\n    )\n}\n\nfunc (f *FilterBuilder) In(path string, args ...interface{}) *FilterBuilder {\n    binds := strings.Join(strings.Split(strings.Repeat("?", len(args)), ""), ",")\n    return f.Append(\n        fmt.Sprintf("'%s' IN (%s)", path, binds),\n        args,\n    )\n}<\/code><\/pre>\n

\u3053\u308c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n

\/\/ GetMessagesByDeviceID \u30c7\u30d0\u30a4\u30b9\u306b\u7d10\u3065\u304f\u30e1\u30c3\u30bb\u30fc\u30b8\u4e00\u89a7\u3092\u53d6\u5f97\nfunc GetMessagesByDeviceID(deviceID uint64) ([]*Message, error) {\n    fb := filterbuilder.NewFilterBuilder()\n    fb.Equal("DeviceID", deviceID)\n\n    messages, err := GetMessages(fb)\n    if err != nil {\n        return nil, err\n    }\n    return messages, nil\n}<\/code><\/pre>\n

\u3053\u306e\u3088\u3046\u306b\u76f4\u611f\u7684\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3051\u308b\u4ed5\u7d44\u307f\u304c\u305f\u304f\u3055\u3093\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

=>MQTT Topic\u306f\u3001\u300c\u30af\u30e9\u30a6\u30c9=>\u30c7\u30d0\u30a4\u30b9\u300d\u306a\u3089Command\u3001\u300c\u30c7\u30d0\u30a4\u30b9=>\u30af\u30e9\u30a6\u30c9\u300d\u306a\u3089Telemetry\u3068\u4e00\u6982\u306b\u304f\u304f\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3068\u304d\u304c\u5b9f\u969b\u306b\u306f\u8d77\u3053\u308a\u305d\u3046\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u307e\u3059(\u3044\u307e\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u306a\u3055\u305d\u3046\u306a\u306e\u3067\u3059\u304c\u2026)\u3002\u3053\u306e\u3078\u3093\u306f\u6a5f\u68b0\u7684\u306b\u5224\u65ad\u305b\u305a\u3001\u3057\u3063\u304b\u308a\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3067\u3059\u3002<\/p>\n

\"\"<\/p>\n

=>\u304a\u5ba2\u69d8\u3068\u4ed5\u69d8\u3092\u8abf\u6574\u3057\u305f\u308a\u3001AWS\u306e\u5236\u9650\u306b\u3064\u3044\u3066\u8abf\u67fb\u3057\u305f\u308a\u3059\u308b\u30b3\u30b9\u30c8\u306f\u304b\u304b\u3063\u3066\u304f\u308b\u306e\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u6570\u5e74\u5358\u4f4d\u306e\u904b\u7528\u3067\u306f\u5927\u304d\u306a\u30b3\u30b9\u30c8\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u3042\u304f\u307e\u3067\u50be\u5411\u3067\u3059\u304c\u3001\u521d\u671f\u6295\u8cc7\u3068\u3057\u3066\u306f\u901a\u5e38\u306e\u958b\u767a\u3088\u308a\u91d1\u984d\u3068\u3057\u3066\u306f\u304b\u304b\u3063\u3066\u304d\u3066\u3057\u307e\u3046\u6c17\u306f\u3057\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u5b9f\u969b\u306b\u64ae\u3063\u3066\u304d\u305f\u5199\u771f\u3067\u3001\u5de6\u4e0a\u304b\u3089\u6642\u8a08\u56de\u308a\u306b\u3001\u3069\u3053\u304b\u3067\u30c0\u30a4\u30d3\u30f3\u30b0\u3057\u305f\u6642(\u5fd8\u308c\u307e\u3057\u305f...)\u3001\u30e1\u30ad\u30b7\u30b3\u30ab\u30f3\u30af\u30f3\u3001\u30d5\u30a3\u30ea\u30d4\u30f3\u30a8\u30eb\u30cb\u30c9\u3001\u30de\u30ec\u30fc\u30b7\u30a2\u30e9\u30f3\u30ab\u30a6\u30a4\u5cf6\u3067\u3059\u3002<\/p>\n

\u307e\u3060\u81f3\u3089\u306a\u3044\u70b9\u304c\u591a\u304b\u3063\u305f\u306e\u3067\u3001\u6b21\u307e\u3067\u306b\u52c9\u5f37\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff01<\/p>\n

MMM\u306f\u3001\u4f1a\u793e\u3068\u3057\u3066\u3082AWS Lambda\u306b\u529b\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u3002\u305c\u3072\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3082\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n

\u30fb\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\uff08AWS Lambda\uff09<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

Serverless Meetup Tokyo\u3068\u3044\u3046\u30a4\u30d9\u30f3\u30c8\u3067\u300cLambda\u3068DynamoDB\u3067IoT\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u958b\u767a\u300d\u3092\u30c6\u30fc\u30de\u306b\u30b9\u30d4\u30fc\u30ab\u30fc\u3092\u3057\u3066\u304d\u307e\u3057\u305f\u3002 \u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u73fe\u5728\u53d6\u308a\u7d44\u3093\u3067\u3044\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u958b\u767a\u30b9\u30bf\u30a4\u30eb\u3092\u7d39\u4ecb\u3057\u305f\u3082\u306e\u3067\u3001\u3044\u308d\u3044\u308d\u3056\u3063\u304f\u3070\u3089\u3093\u306b\u30ea\u30a2\u30eb\u306a\u3068\u3053\u308d\u3092\u8a71\u3059\u3068\u3044\u3046\u306e\u3092\u610f\u8b58\u3057\u307e\u3057\u305f\u3002\u601d\u3063\u305f\u3088\u308a\u300c\u3046\u3061\u3082\u540c\u3058\u3088\u3046\u306a\u3053\u3068\u3067\u60a9\u3093\u3067\u308b\u3093\u3067\u3059\u300d\u307f\u305f\u3044\u306b\u3044\u3063\u3066\u304f\u3060\u3055\u308b\u65b9\u304c\u3044\u3066\u3088\u304b\u3063\u305f\u3067\u3059\u3002 \u53e3\u982d […]<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,21],"tags":[264],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/565"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/565\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}