def tags_action(client, stream_name, tags, action='create', check_mode=False):
 success = False
 err_msg = ''
 params = {'StreamName': stream_name}
 try:
  if (not check_mode):
   if (action == 'create'):
    params['Tags'] = tags
    client.add_tags_to_stream(**params)
    success = True
   elif (action == 'delete'):
    params['TagKeys'] = tags.keys()
    client.remove_tags_from_stream(**params)
    success = True
   else:
    err_msg = 'Invalid action {0}'.format(action)
  elif (action == 'create'):
   success = True
  elif (action == 'delete'):
   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 tags_action ( client , stream_name , tags , action = 'create' , check_mode = False ) : success = False err_msg = '' params = { 'StreamName' : stream_name } try : if ( not check_mode ) : if ( action == 'create' ) : params [ 'Tags' ] = tags client . add_tags_to_stream ( ** params ) success = True elif ( action == 'delete' ) : params [ 'TagKeys' ] = tags . keys ( ) client . remove_tags_from_stream ( ** params ) success = True else : err_msg = 'Invalid action {0}' . format ( action ) elif ( action == 'create' ) : success = True elif ( action == 'delete' ) : success = True else : err_msg = 'Invalid action {0}' . format ( action ) except botocore . exceptions . ClientError as e : err_msg = str ( e ) return ( success , err_msg )
create or delete multiple tags from a kinesis stream .