// Ġsnippet - source description :[ Delete Faces From Collection . kt Ġdemonstrates Ġhow Ġto Ġdelete Ġfaces Ġfrom Ġan ĠAmazon ĠRe k ogn ition Ġcollection .] č Ċ // snippet - keyword :[ AWS ĠSDK Ġfor ĠKotlin ] č Ċ // Ġsnippet - service :[ Amazon ĠRe k ogn ition ] č Ċ // Ġsnippet - keyword :[ Code ĠSample ] č Ċ // Ġsnippet - s ourc etype :[ full - example ] č Ċ // Ġsnippet - s ourced ate :[ 1 1 - 0 5 - 2 0 2 1 ] č Ċ // Ġsnippet - source author :[ sc mac don Ġ- ĠAWS ] č Ċ /* čĊĠĠ ĠCopyright ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . ĠAll ĠRights ĠReserved . čĊĠĠ ĠSPDX - License - Identifier : ĠApache - 2 . 0 č Ċ */ č Ċ package Ġcom . kotlin . rek ogn ition čĊč Ċ // Ġsnippet - start :[ rek ogn ition . kotlin . delete _ faces _ collection . import ] č Ċ import Ġaws . sdk . kotlin . services . rek ogn ition . Re k ogn ition Client č Ċ import Ġaws . sdk . kotlin . services . rek ogn ition . model . Delete Faces Request č Ċ import Ġaws . sdk . kotlin . services . rek ogn ition . model . Re k ogn ition Exception č Ċ import Ġkotlin . system . exit Process č Ċ // Ġsnippet - end :[ rek ogn ition . kotlin . delete _ faces _ collection . import ] čĊč Ċ /** č Ċ To Ġrun Ġthis ĠKotlin Ġcode Ġexample , Ġensure Ġthat Ġyou Ġhave Ġsetup Ġyour Ġdevelopment Ġenvironment , č Ċ including Ġyour Ġcredentials . čĊč Ċ For Ġinformation , Ġsee Ġthis Ġdocumentation Ġtopic : č Ċ https :// docs . aws . amazon . com / sdk - for - kotlin / latest / developer - guide / setup . html čĊ Ġ*/ čĊč Ċ suspend Ġfun Ġmain ( args : ĠArray < String > ){ čĊčĊĠĠĠ Ġval Ġusage Ġ= Ġ""" čĊĠĠĠ ĠUsage : ĠčĊĠĠĠĠĠĠĠĠ Ġ< collection Id > Ġ< face Id > Ġ čĊčĊĠĠĠ ĠWhere : čĊĠĠĠĠĠĠĠ Ġcollection Id Ġ- Ġthe Ġid Ġof Ġthe Ġcollection Ġfrom Ġwhich Ġfaces Ġare Ġdeleted . ĠčĊĠĠĠĠĠĠĠ Ġface Id Ġ- Ġthe Ġid Ġof Ġthe Ġface Ġto Ġdelete . ĠčĊĠĠĠ Ġ""" čĊčĊĠĠĠ Ġif Ġ( args . size Ġ!= Ġ 2 ) Ġ{ čĊĠĠĠĠĠĠĠ Ġprintln ( usage ) čĊĠĠĠĠĠĠĠ ĠSystem . exit ( 1 ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġval Ġcollection Id Ġ= Ġargs [ 0 ] čĊĠĠĠ Ġval Ġface Id Ġ= Ġargs [ 1 ] čĊĠĠĠ Ġval Ġre k Client Ġ= ĠRe k ogn ition Client { Ġregion Ġ= Ġ" us - east - 1 "} čĊĠĠĠ Ġdelete Faces Collection ( rek Client , Ġcollection Id , Ġface Id ) čĊĠĠĠ Ġre k Client . close () č Ċ } čĊč Ċ // Ġsnippet - start :[ rek ogn ition . kotlin . delete _ faces _ collection . main ] č Ċ suspend Ġfun Ġdelete Faces Collection ( rek Client : ĠRe k ogn ition Client , Ġcollection Id Val : ĠString ?, Ġface Id Val : ĠString Ġ) Ġ{ čĊčĊĠĠĠ Ġtry Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġdelete Faces Request Ġ= ĠDelete Faces Request Ġ{ čĊĠĠĠĠĠĠĠĠĠĠĠ Ġcollection Id Ġ= Ġcollection Id Val čĊĠĠĠĠĠĠĠĠĠĠĠ Ġface Ids Ġ= ĠlistOf ( face Id Val ) čĊĠĠĠĠĠĠĠ Ġ} čĊčĊĠĠĠĠĠĠĠ Ġre k Client . delete Faces ( delete Faces Request ) čĊĠĠĠĠĠĠĠ Ġprintln ("$ face Id Val Ġwas Ġdeleted Ġfrom Ġthe Ġcollection ") čĊčĊĠĠĠ Ġ} Ġcatch Ġ( e : ĠRe k ogn ition Exception ) Ġ{ čĊĠĠĠĠĠĠĠ Ġprintln ( e . message ) čĊĠĠĠĠĠĠĠ Ġre k Client . close () čĊĠĠĠĠĠĠĠ Ġexit Process ( 0 ) čĊĠĠĠ Ġ} č Ċ } č Ċ // Ġsnippet - end :[ rek ogn ition . kotlin . delete _ faces _ collection . main ]