def retention_action(client, stream_name, retention_period=24, action='increase', check_mode=False):
 success = False
 err_msg = ''
 params = {'StreamName': stream_name}
 try:
  if (not check_mode):
   if (action == 'increase'):
    params['RetentionPeriodHours'] = retention_period
    client.increase_stream_retention_period(**params)
    success = True
    err_msg = 'Retention Period increased successfully to {0}'.format(retention_period)
   elif (action == 'decrease'):
    params['RetentionPeriodHours'] = retention_period
    client.decrease_stream_retention_period(**params)
    success = True
    err_msg = 'Retention Period decreased successfully to {0}'.format(retention_period)
   else:
    err_msg = 'Invalid action {0}'.format(action)
  elif (action == 'increase'):
   success = True
  elif (action == 'decrease'):
   success = True
  else:
   err_msg = 'Invalid action {0}'.format(action)
 except botocore.exceptions.ClientError as e:
  err_msg = str(e)
 return (success, err_msg)

def retention_action ( client , stream_name , retention_period = 24 , action = 'increase' , check_mode = False ) : success = False err_msg = '' params = { 'StreamName' : stream_name } try : if ( not check_mode ) : if ( action == 'increase' ) : params [ 'RetentionPeriodHours' ] = retention_period client . increase_stream_retention_period ( ** params ) success = True err_msg = 'Retention Period increased successfully to {0}' . format ( retention_period ) elif ( action == 'decrease' ) : params [ 'RetentionPeriodHours' ] = retention_period client . decrease_stream_retention_period ( ** params ) success = True err_msg = 'Retention Period decreased successfully to {0}' . format ( retention_period ) else : err_msg = 'Invalid action {0}' . format ( action ) elif ( action == 'increase' ) : success = True elif ( action == 'decrease' ) : success = True else : err_msg = 'Invalid action {0}' . format ( action ) except botocore . exceptions . ClientError as e : err_msg = str ( e ) return ( success , err_msg )
increase or decreaste the retention of messages in the kinesis stream .