Slide 1

Slide 1 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. SmithyでSDKコードを ⽣成していく的なおはなし Takao Mitsuyoshi N A K A N O S H I M A . D E V # 2 8

Slide 2

Slide 2 text

© 2022, Amazon Web Services, Inc. or its affiliates. 光吉 隆雄(Mitsuyoshi Takao) アマゾンウェブサービスジャパン合同会社 技術統括本部⻄⽇本ソリューション部 ソリューションアーキテクト 経歴︓ ⼤⼿ゲーム会社基盤開発・DevOps推進 Infrastructure as Code, CI/CD, Container 好きなAWSサービス︓ ⻄⽇本のエンタープライズ企業を担当するソリューションアーキテクトとして、 新たに AWS の導⼊をご検討頂いているお客様/既に AWS をご利⽤頂いてい るお客様の課題解決を技術⾯から⽀援しています。 ⾃⼰紹介 AWS CodeBuild

Slide 3

Slide 3 text

© 2022, Amazon Web Services, Inc. or its affiliates. アジェンダ • AWS SDKの歴史的な話 • Smithyの特徴 • smithy-rubyを触ってみる • まとめ

Slide 4

Slide 4 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. AWS SDKの歴史的な話 4

Slide 5

Slide 5 text

© 2022, Amazon Web Services, Inc. or its affiliates. 増える AWS SDK for XXX 5 Rust, Kotlin, Swift Developer Preview Previewを加えると今や AWS SDK は12個の⾔語をサポートしている

Slide 6

Slide 6 text

© 2022, Amazon Web Services, Inc. or its affiliates. AWS の新機能に対する対応 6 機能追加発⽣ 11:00 CodeGen

Slide 7

Slide 7 text

© 2022, Amazon Web Services, Inc. or its affiliates. 歴史的背景 7

Slide 8

Slide 8 text

© 2022, Amazon Web Services, Inc. or its affiliates. Smithyの導⼊ 8

Slide 9

Slide 9 text

© 2022, Amazon Web Services, Inc. or its affiliates. C2Jとおなじ︖ 9

Slide 10

Slide 10 text

© 2022, Amazon Web Services, Inc. or its affiliates. AWS独⾃の機能の追加 10

Slide 11

Slide 11 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. Smithyの特徴 11

Slide 12

Slide 12 text

© 2022, Amazon Web Services, Inc. or its affiliates. Smithyの特徴 12 • Protocol-agnostic • Designed to evolve • Codify and enforce API governance • Resource based

Slide 13

Slide 13 text

© 2022, Amazon Web Services, Inc. or its affiliates. Smithyの特徴 13 • Protocol-agnostic • Designed to evolve • Codify and enforce API governance • Resource based

Slide 14

Slide 14 text

© 2022, Amazon Web Services, Inc. or its affiliates. 記述の基本 各オブジェクトにShape(型のようなもの)がある。 各オブジェクトにTraits(特性)を記述してより多くの情報を付与 14 @title("ACME Simple Image Service") service Weather { version: "2006-03-01", resources: [City] } Shape(型) 名前 プロパティ 値 Traits(特性)

Slide 15

Slide 15 text

© 2022, Amazon Web Services, Inc. or its affiliates. サービスとリソース 記述しているサービスの全体的な情報をserviceとして記述。 サービスの中で扱われるリソースを記述 15 service Weather { version: "2006-03-01", resources: [City] } resource City { identifiers: { cityId: CityId }, read: GetCity } @pattern("^[A-Za-z0-9 ]+$") string CityId リソース サービス

Slide 16

Slide 16 text

© 2022, Amazon Web Services, Inc. or its affiliates. オペレーション 16 @readonly operation GetCity { input: GetCityInput, output: GetCityOutput } @input structure GetCityInput { @required cityId: CityId } @output structure GetCityOutput { @required name: String } オペレーション(操作) 取得時に⼀意の識別⼦ として必須のためtraits 結果に必ずnameが 含まれることの宣⾔

Slide 17

Slide 17 text

© 2022, Amazon Web Services, Inc. or its affiliates. オペレーション 17 @readonly operation GetCity { input: GetCityInput, output: GetCityOutput } @input structure GetCityInput { @required cityId: CityId } @output structure GetCityOutput { @required name: String } オペレーション(操作) 取得時に⼀意の識別⼦ として必須のためtraits 結果に必ずnameが 含まれることの宣⾔ これらの定義の中にはプロトコル、シリアライズ形式といった情報は存在しない とはいえ必須でないというだけで、 たとえば @http という traitsがあり、httpプロトコルに関する情報を付与できる。 またOpenAPIにコンバートすることも可能。(完全なサポートではないため不可逆)

Slide 18

Slide 18 text

© 2022, Amazon Web Services, Inc. or its affiliates. Smithyの特徴 18 • Protocol-agnostic • Designed to evolve • Codify and enforce API governance • Resource based

Slide 19

Slide 19 text

© 2022, Amazon Web Services, Inc. or its affiliates. 拡張性 19 • デフォルトで様々なTraitsが存在 • AWSの機能に関するTraitsも • 既存リソースへの追加などに対しては 下位互換性を持っている

Slide 20

Slide 20 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. smithy-rubyを触ってみる 20

Slide 21

Slide 21 text

© 2022, Amazon Web Services, Inc. or its affiliates. AWS SDKと関係ない rubygems の⽣成 21 high_score_servi ce (ruby on rails) high-score- service.smithy high-score- service gem CodeGen request

Slide 22

Slide 22 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. デモ 22

Slide 23

Slide 23 text

© 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. まとめ 23

Slide 24

Slide 24 text

© 2022, Amazon Web Services, Inc. or its affiliates. まとめ 24 • AWS SDK はすべての⾔語で同⼀の機能を保証するためにより良い⼿法で改 善を加え続けている • Smithy は AWS のためのものではなくプロトコルやフォーマットにとらわ れないIDL • (開発中の⾔語も多いけど)好きな⾔語で Smithy を触ってみよう!

Slide 25

Slide 25 text

© 2022, Amazon Web Services, Inc. or its affiliates. 参考 25 • AWS re:Invent 2021 - Building with the new AWS SDKs for Rust, Kotlin, and Swift • https://www.youtube.com/watch?v=Nhk1K1AjYvg • Smithy • https://awslabs.github.io/smithy/ • Developer Preview: Ruby SDK code generation using Smithy • https://aws.amazon.com/jp/blogs/developer/developer-preview-smithy-code- generated-ruby-sdk/

Slide 26

Slide 26 text

© 2022, Amazon Web Services, Inc. or its affiliates. Thank you! © 2022, Amazon Web Services, Inc. or its affiliates. 26