Exemple #1
0
def delete(rev: int) -> Dict:
    """Delete user-defined permissions.

    :param rev: Last revision of the permissions.
    :return: The Nexus metadata of the permissions.
    """
    return http_delete([SEGMENT], rev=rev)
Exemple #2
0
def delete_(endpoint: str, rev: int) -> Dict:
    """Delete user-defined permissions (full path version).

    :param endpoint: Endpoint for permissions.
    :param rev: Last revision of the permissions.
    :return: The Nexus metadata of the permissions.
    """
    return http_delete(endpoint, rev=rev)
Exemple #3
0
def delete_(path: str, rev: int) -> Dict:
    """Delete ACLs on a full path.

    :param path: Full path on which deleting ACLs.
    :param rev: Last revision of the ACLs.
    :return: The Nexus metadata of the ACLs.
    """
    return http_delete(path, rev=rev)
Exemple #4
0
def deprecate_(path: str, rev: int) -> Dict:
    """Deprecate a realm (full path version).

    :param path: Full path of the realm.
    :param rev: Last revision of the realm.
    :return: The Nexus metadata of the deprecated realm.
    """
    return http_delete(path, rev=rev)
Exemple #5
0
def delete(subpath: str, rev: int) -> Dict:
    """Delete ACLs on a subpath.

    :param subpath: Subpath on which deleting ACLs.
    :param rev: Last revision of the ACLs.
    :return: The Nexus metadata of the ACLs.
    """
    return http_delete([SEGMENT, subpath], rev=rev)
Exemple #6
0
def deprecate_(path: str, rev: int) -> Dict:
    """Deprecate a resolver (full path version).

    :param path: Full path of the resolver (i.e. includes its ID), URL encoded.
    :param rev: Last revision of the resolver.
    :return: The Nexus metadata of the deprecated resolver.
    """
    return http_delete(path, rev=rev)
Exemple #7
0
def deprecate(subpath: str, rev: int) -> Dict:
    """Deprecate a realm.

    :param subpath: Subpath of the realm.
    :param rev: Last revision of the realm.
    :return: The Nexus metadata of the deprecated realm.
    """
    return http_delete([SEGMENT, subpath], rev=rev)
Exemple #8
0
def deprecate(org_label: str, project_label: str, storage_id: str, rev: int) -> Dict:
    """Deprecate storage

    :param org_label: Label of the organization the storage belongs to.
    :param project_label: Label of the project the storage belongs to.
    :param storage_id: the storage ID
    :param rev: last known revision of the storage
    :return: The Nexus metadata of the storage.
    """
    return http_delete([SEGMENT, org_label, project_label, url_encode(storage_id)], rev=rev)
Exemple #9
0
def deprecate(org_label: str, project_label: str, id: str, rev: int) -> Dict:
    """Deprecate a resolver.

    :param org_label: Label of the organization the resolver belongs to.
    :param project_label: Label of the project the resolver belongs to.
    :param id: ID of the resolver, given as an IRI which is not URL encoded.
    :param rev: Last revision of the resolver.
    :return: The Nexus metadata of the deprecated resolver.
    """
    encoded_id = encode_url(id)
    return http_delete([SEGMENT, org_label, project_label, encoded_id],
                       rev=rev)
Exemple #10
0
def deprecate(org_label: str, project_label: str, file_id: str, rev: int) -> Dict:
    """
        Deprecate a file.
        Files cannot be deleted in Nexus, once one is deprecated, it is no longer possible to update it.

        :param org_label: The label of the organization that the file belongs to.
        :param project_label: The label of the project that the file belongs to.
        :param file_id: The identifier of the file to deprecate.
        :param rev: The last revision of the file.
        :return: A payload containing only the Nexus metadata for this deprecated file.
    """
    path = [SEGMENT, org_label, project_label, url_encode(file_id)]
    return http_delete(path, rev=rev)
Exemple #11
0
def deprecate(org_label, rev):
    """
    Deprecate an organization. Nexus does not allow deleting organizations so deprecating is the way to flag them as
    not usable anymore.
    A deprecated organization can not be modified/updated.

    :param org_label: The label of the organization to deprecate
    :param rev: The previous revision number. To be provided to make sure the user is well aware of the details
        of the last revision of this organisation.
    :return: The payload from the Nexus API as a dictionary. This contains the Nexus metadata of the organization
    """
    org_label = url_encode(org_label)
    path = "/orgs/" + org_label + "?rev=" + str(rev)

    return http_delete(path, use_base=True)
Exemple #12
0
def deprecate(resource, rev=None):
    """
    Flag a resource as deprecated. Resources cannot be deleted in Nexus, once one is deprecated, it is no longer
    possible to update it.

    :param resource: payload of a previously fetched resource
    :param rev: OPTIONAL The previous revision you want to update from.
        If not provided, the rev from the resource argument will be used.
    :return: A payload containing only the Nexus metadata for this deprecated resource.
    """

    if rev is None:
        rev = resource["_rev"]

    path = resource["_self"] + "?rev=" + str(rev)

    return http_delete(path, use_base=False)
Exemple #13
0
def deprecate_(file: Dict, rev: Optional[int] = None) -> Dict:
    """
        Deprecate a file from an existing file resource payload, for instance the value returned
        by nexus.file.fetch(), where some fields where modified, added or removed.
        Files cannot be deleted in Nexus, once one is deprecated, it is no longer possible to update it.

        :param file: Payload of a previously fetched file.
        :param rev: OPTIONAL The last revision of the file. If not provided, the rev from the file argument will be used.
        :return: A payload containing only the Nexus metadata for this deprecated file.
    """

    if rev is None:
        rev = file["_rev"]

    path = file["_self"]

    return http_delete(path, rev=rev)
Exemple #14
0
def deprecate_es(esview, rev=None):
    """
    Update a ElasticSearch view. The esview object is most likely the returned value of a
    nexus.views.fetch(), where some fields where modified, added or removed.
    Note that the returned payload only contains the Nexus metadata and not the
    complete view.

    :param esview: payload of a previously fetched view, with the modification to be updated
    :param rev: OPTIONAL The previous revision you want to update from.
        If not provided, the rev from the view argument will be used.
    :return: A payload containing only the Nexus metadata for this updated view.
    """

    if rev is None:
        rev = esview["_rev"]

    path = esview["_self"] + "?rev=" + str(rev)

    return http_delete(path, esview, use_base=False)
Exemple #15
0
def deprecate(project, rev=None):
    """
    Deprecate a project. Nexus does not allow deleting projects so deprecating is the way to flag them as
    not usable anymore.
    A deprecated project cannot be modified/updated.

    :param project: The project payload, most likely retrieved with fetch()
    :param rev: OPTIONAL provide the last version of the project to make sure the user has full knowledge of
        the version being deprecated. If not provided, the revision number from the project payload will be used.
    :return: The payload from the Nexus API as a dictionary. This contains the Nexus metadata of the project
    """

    org_label = url_encode(project["_organizationLabel"])
    project_label = url_encode(project["_label"])

    if rev is None:
        rev = project["_rev"]

    path = "/projects/" + org_label + "/" + project_label + "?rev=" + str(rev)

    return http_delete(path, use_base=True)