def get(self, namespace): """ Returns all accounts in the namespace. Example: For a namespace `accounts`, a list of accounts will be returned based on [Account Schema](https://github.com/Netflix-Skunkworks/swag-client/blob/master/swag_client/schemas/v2.py#L43) """ g.metric_tags.update({'endpoint': 'namespace.list_all'}) swag.namespace = namespace return jsonify(swag.get_all())
def get(self, namespace, owner): """ Returns a list of accounts for a given owner. """ g.metric_tags.update({'endpoint': 'owner.list_accounts_with_owner'}) swag.namespace = namespace account_data = swag.get_all("[?owner=='{}']".format(owner)) if len(account_data) == 0: return jsonify([]) else: return jsonify(account_data)
def get(self, namespace, env): """ Returns a list of accounts for a given environment. """ g.metric_tags.update({'endpoint': 'environment.list_accounts_in_environment'}) swag.namespace = namespace account_data = swag.get_all("[?environment=='{}']".format(env)) if len(account_data) == 0: return jsonify([]) else: return jsonify(account_data)
def get(self, namespace, account_status): """ Returns a list of accounts with the given account_status """ g.metric_tags.update({'endpoint': 'accounts.get_accounts_with_status'}) swag.namespace = namespace account_data = swag.get_all( "[?account_status=='{}']".format(account_status)) if len(account_data) == 0: return jsonify([]) elif len(account_data) == 1: return jsonify([account_data]) else: return jsonify(account_data)
def get(self, namespace): swag.namespace = namespace return swag.get_all()