def aws_get_resource_tags(accounts): tags = AWSDetailedLineitem.get_available_tags( [account.get_aws_user_id() for account in accounts])['tags'] if not len(tags): return jsonify(message=get_next_update_estimation_message_aws( accounts, AWS_KEY_PROCESSING_INTERVAL_HOURS)) return jsonify(tags=sorted(tags, key=unicode.lower))
def aws_get_resource_tags_with_data(accounts): tags = list(set(itertools.chain.from_iterable( AWSDetailedLineitem.get_available_tags(account.get_aws_user_id(), only_with_data=account.key)['tags'] for account in accounts ))) if not len(tags): return jsonify(message=get_next_update_estimation_message_aws(accounts, AWS_KEY_PROCESSING_INTERVAL_HOURS)) return jsonify(tags=sorted(tags, key=unicode.lower))
def aws_get_resource_tags_for_s3(accounts): tags = list(set(itertools.chain.from_iterable( AWSDetailedLineitem.get_available_tags( account.get_aws_user_id(), product_name='Simple Storage Service', )['tags'] for account in accounts ))) return jsonify(tags=sorted(tags, key=unicode.lower))