testbench/servers/projects_rest_server.py
def hmac_keys_list(project_id):
        """Implement the 'HmacKeys: list' API: return the HMAC keys in a project."""
        # Lookup the bucket, if this fails the bucket does not exist, and this
        # function should return an error.
        project = db.get_project(project_id)
        result = {
            "kind": "storage#hmacKeysMetadata",
            "next_page_token": "",
            "items": [],
        }

        state_filter = lambda x: x.get("state") != "DELETED"
        if flask.request.args.get("deleted") == "true":
            state_filter = lambda x: True

        items = []
        if flask.request.args.get("serviceAccountEmail"):
            sa = flask.request.args.get("serviceAccountEmail")
            service_account = project.service_account(sa)
            if service_account:
                items = service_account.key_items()
        else:
            for sa in project.service_accounts.values():
                items.extend(sa.key_items())

        result["items"] = [i for i in items if state_filter(i)]
        fields = flask.request.args.get("fields", None)
        return testbench.common.filter_response_rest(result, None, fields)
Implement the 'HmacKeys: list' API: return the HMAC keys in a project.
Implement the 'HmacKeys: list' API: return the HMAC keys in a project.
Implement the ' HmacKeys : list ' API : return the HMAC keys in a project .
def hmac_keys_list(project_id):
        project = db.get_project(project_id)
        result = {
            "kind": "storage#hmacKeysMetadata",
            "next_page_token": "",
            "items": [],
        }
        state_filter = lambda x: x.get("state") != "DELETED"
        if flask.request.args.get("deleted") == "true":
            state_filter = lambda x: True
        items = []
        if flask.request.args.get("serviceAccountEmail"):
            sa = flask.request.args.get("serviceAccountEmail")
            service_account = project.service_account(sa)
            if service_account:
                items = service_account.key_items()
        else:
            for sa in project.service_accounts.values():
                items.extend(sa.key_items())
        result["items"] = [i for i in items if state_filter(i)]
        fields = flask.request.args.get("fields", None)
        return testbench.common.filter_response_rest(result, None, fields)
def hmac_keys_list ( project_id ) : project = db . get_project ( project_id ) result = { "kind" : "storage#hmacKeysMetadata" , "next_page_token" : "" , "items" : [ ] , } state_filter = lambda x : x . get ( "state" ) != "DELETED" if flask . request . args . get ( "deleted" ) == "true" : state_filter = lambda x : True items = [ ] if flask . request . args . get ( "serviceAccountEmail" ) : sa = flask . request . args . get ( "serviceAccountEmail" ) service_account = project . service_account ( sa ) if service_account : items = service_account . key_items ( ) else : for sa in project . service_accounts . values ( ) : items . extend ( sa . key_items ( ) ) result [ "items" ] = [ i for i in items if state_filter ( i ) ] fields = flask . request . args . get ( "fields" , None ) return testbench . common . filter_response_rest ( result , None , fields )
Implement the 'HmacKeys: list' API: return the HMAC keys in a project.
Implement the ' HmacKeys : list ' API : return the HMAC keys in a project .
"""Implement the 'HmacKeys: list' API: return the HMAC keys in a project.""" # Lookup the bucket, if this fails the bucket does not exist, and this # function should return an error.
project_id