package Ġcom . github . ik oval y ov . infrastructure . dynamodb . factory Ċ Ċ import Ġio . mic ronaut . context . annotation . Factory Ċ import Ġio . mic ronaut . context . annotation . Property Ċ import Ġio . mic ronaut . context . annotation . Re places Ċ import Ġio . mic ronaut . context . annotation . Requires Ċ import Ġjak arta . inject . Singleton Ċ import Ġsoftware . amazon . aw ssdk . auth . credentials . Aws Basic Credentials Ċ import Ġsoftware . amazon . aw ssdk . regions . Region Ċ import Ġsoftware . amazon . aw ssdk . services . dynamodb . D ynamo Db Async Client Ċ import Ġsoftware . amazon . aw ssdk . services . dynamodb . D ynamo Db Async Client Builder Ċ import Ġjava . net . URI Ċ Ċ @ Factory Ċ @ Requires ( property Ġ= Ġ" blog . aws . local stack ", Ġvalue Ġ= Ġ" true ") Ċ class ĠD ynamo Db Client Factory ( ĊĠĠĠ Ġ@ Property ( name Ġ= Ġ" blog . aws . endpoint ") Ġprivate Ġval Ġendpoint : ĠString , ĊĠĠĠ Ġ@ Property ( name Ġ= Ġ" blog . aws . credentials . username ") Ġprivate Ġval Ġusername : ĠString , ĊĠĠĠ Ġ@ Property ( name Ġ= Ġ" blog . aws . credentials . secret AccessKey ") Ġprivate Ġval Ġaccess Key : ĠString , ĊĠĠĠ Ġ@ Property ( name Ġ= Ġ" aws . region ", ĠdefaultValue Ġ= Ġ"") Ġprivate Ġval Ġregion : ĠString ?, ĊĠĠĠ Ġprivate Ġval Ġclient Builder : ĠD ynamo Db Async Client Builder Ċ ) Ġ{ ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Requires ( property Ġ= Ġ" blog . aws . local stack ", Ġvalue Ġ= Ġ" true ") ĊĠĠĠ Ġ@ Re places ( D ynamo Db Async Client :: class ) ĊĠĠĠ Ġfun Ġcreate D ynamo Db Client (): ĠD ynamo Db Async Client Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġclient Builder ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. endpoint Override ( URI ( endpoint )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. credentials Provider Ġ{ ĠAws Basic Credentials . create ( username , Ġaccess Key ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! region . isNull OrEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . region ( Region . of ( region )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} Ċ } Ċ