<jupyter_start><jupyter_text>User API<jupyter_code>rdm = randint(0,1000)
rdm
subpath = "myorg{}".format(rdm)
subpath_star = "{}/*".format(subpath)
identity = IDENTITY
identity2 = IDENTITY_BIS
identities = [identity, identity2]
pp(nxs.acls.fetch(subpath))
pp(nxs.acls.fetch(subpath, rev=2))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.fetch(subpath, rev=2, self=False))
pp(nxs.acls.list(subpath_star))
pp(nxs.acls.list(subpath_star, ancestors=True))
pp(nxs.acls.list(subpath_star, self=False))
pp(nxs.acls.list(subpath_star, ancestors=True, self=False))
pp(nxs.acls.replace(subpath, [["projects/read"]], [identity], rev=0))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.replace(subpath, [["projects/read"], ["resources/read"]], identities, rev=1))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.append(subpath, [["projects/write"]], [identity], rev=2))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.append(subpath, [["projects/create"], ["resources/write"]], identities, rev=3))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.subtract(subpath, [["projects/read"]], [identity], rev=4))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.subtract(subpath, [["projects/create"], ["resources/read"]], identities, rev=5))
pp(nxs.acls.fetch(subpath, self=False))
pp(nxs.acls.delete(subpath, rev=6))
pp(nxs.acls.fetch(subpath, self=False))<jupyter_output><empty_output><jupyter_text>Developer API<jupyter_code>import json
import copy
endpoint = "{}/acls".format(DEPLOYMENT)
endpoint
rdm2 = randint(0, 1000)
rdm2
subpath2 = "myorg{}".format(rdm2)
path = "{}/{}".format(endpoint, subpath2)
path
path_star = "{}/*".format(path)
path_star
acls = {
    "acl": [
        {
            "permissions": [
                "projects/read",
            ],
            "identity": IDENTITY
        },
    ]
}
append_acls = copy.deepcopy(acls)
append_acls["@type"] = "Append"
append_acls["acl"][0]["permissions"] = ["projects/write"]
subtract_acls = copy.deepcopy(acls)
subtract_acls["@type"] = "Subtract"
subtract_acls["acl"][0]["permissions"] = ["projects/read"]
acls_list = {
    "acl": [
        {
            "permissions": [
                "projects/read",
            ],
            "identity": IDENTITY
        },
        {
            "permissions": [
                "resources/read",
            ],
            "identity": IDENTITY_BIS
        },
    ]
}
append_acls_list = copy.deepcopy(acls_list)
append_acls_list["@type"] = "Append"
append_acls_list["acl"][0]["permissions"] = ["projects/create"]
append_acls_list["acl"][1]["permissions"] = ["resources/write"]
subtract_acls_list = copy.deepcopy(acls_list)
subtract_acls_list["@type"] = "Subtract"
subtract_acls_list["acl"][0]["permissions"] = ["projects/create"]
subtract_acls_list["acl"][1]["permissions"] = ["resources/read"]
pp(nxs.acls.fetch_(path))
pp(nxs.acls.fetch_(path, rev=2))
pp(nxs.acls.fetch_(path, self=False))
pp(nxs.acls.fetch_(path, rev=2, self=False))
pp(nxs.acls.list_(path_star))
pp(nxs.acls.list_(path_star, ancestors=True))
pp(nxs.acls.list_(path_star, self=False))
pp(nxs.acls.list_(path_star, ancestors=True, self=False))
pp(acls)
pp(nxs.acls.replace_(path, acls, rev=0))
pp(nxs.acls.fetch_(path, self=False))
pp(acls_list)
pp(nxs.acls.replace_(path, acls_list, rev=1))
pp(nxs.acls.fetch_(path, self=False))
pp(append_acls)
pp(nxs.acls.append_(path, append_acls, rev=2))
pp(nxs.acls.fetch_(path, self=False))
pp(append_acls_list)
pp(nxs.acls.append_(path, append_acls_list, rev=3))
pp(nxs.acls.fetch_(path, self=False))
pp(subtract_acls)
pp(nxs.acls.subtract_(path, subtract_acls, rev=4))
pp(nxs.acls.fetch_(path, self=False))
pp(subtract_acls_list)
pp(nxs.acls.subtract_(path, subtract_acls_list, rev=5))
pp(nxs.acls.fetch_(path, self=False))
pp(nxs.acls.delete_(path, rev=6))
pp(nxs.acls.fetch_(path, self=False))<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup