// ĠCopyright Ġ 2 0 2 0 ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . ĠAll ĠRights ĠReserved . Ċ // ĠSPDX - License - Identifier : ĠApache - 2 . 0 Ċ Ċ package Ġsoftware . aws . tool k its . jetbrains . services . cloud watch . logs Ċ Ċ import Ġsoftware . amazon . aw ssdk . services . cloud watch logs . Cloud Watch Logs Client Ċ import Ġsoftware . amazon . aw ssdk . services . cloud watch logs . model . Resource NotFoundException Ċ Ċ fun ĠCloud Watch Logs Client . check If Log Group Exists ( log Group : ĠString ): ĠBoolean Ġ{ ĊĠĠĠ Ġval Ġexisting Groups Ġ= Ġdescribe Log Groups Ġ{ Ġit . log GroupName Prefix ( log Group ) Ġ} ĊĠĠĠ Ġreturn Ġexisting Groups . log Groups (). any Ġ{ Ġit . log GroupName () Ġ== Ġlog Group Ġ} Ċ } Ċ Ċ fun ĠCloud Watch Logs Client . check If Log Stream Exists ( log Group : ĠString , Ġlog Stream : ĠString ) Ġ= Ġtry Ġ{ ĊĠĠĠ Ġval Ġexisting Streams Ġ= Ġdescribe Log Streams Ġ{ Ġit . log GroupName ( log Group ). log Stream Name Prefix ( log Stream ) Ġ} ĊĠĠĠ Ġexisting Streams . log Streams (). any Ġ{ Ġit . log Stream Name () Ġ== Ġlog Stream Ġ} ĊĠĠĠ Ġ// ĠThrow n Ġif Ġthe Ġlog Ġgroup Ġdoes Ġnot Ġexist Ċ } Ġcatch Ġ( e : ĠResource NotFoundException ) Ġ{ ĊĠĠĠ Ġfalse Ċ } Ċ