Skip to content

ReposcanApi

Michael Mraka edited this page Apr 21, 2020 · 9 revisions

Reposcan API

Syncing repositories

  • automatically from configured Git and using default entitlement certificates, configure following env variables and trigger PUT /v1/sync
  • manually passing input repository list JSON and triggering PUT /v1/sync

API list

For full list of API endpoints please refer to Swagger doc.

Example commands

$ curl -H "Authorization: dummy" -d '[{"repos": {"fedora-27-updates": "https://mirrors.nic.cz/fedora/linux/updates/27/x86_64/"}}]' -X POST http://127.0.0.1:8081/api/v1/sync/repo
$ curl -H "Authorization: dummy" -H "Content-type: application/json" -d @repolist.json -X POST http://127.0.0.1:8081/api/v1/repos
$ curl -H "Authorization: dummy" -X PUT http://127.0.0.1:8081/api/v1/sync/repo
$ curl -H "Authorization: dummy" -X PUT http://127.0.0.1:8081/api/v1/sync/cve
$ curl -H "Authorization: dummy" -X PUT http://127.0.0.1:8081/api/v1/sync

Authenticated usage

  • in non-prod env, any Authorization value is accepted

  • grants manage permissions to users located in RedHatInsights organization (users membership has to be public)

  • using personal Github token with read:user permission

      $ curl -H "Authorization: token <github token here>" -X PUT https://reposcan-prod/api/v1/sync
    

Input JSON example

  • NOTE: "entitlement_cert" section can be omitted and DEFAULT_CA_CERT, DEFAULT_CERT variables be configured.
[{
  "entitlement_cert": {
    "name": "RHSM-CDN",
    "ca_cert": "<CA CERTIFICATE>",
    "cert": "<CLIENT CERTIFICATE>",
    "key": "<CLIENT KEY>"
  },
  "products": {
    "Red Hat Enterprise Linux Server": {
      "redhat_eng_product_id": 69,
      "content_sets": {
        "rhel-7-server-rpms": {
          "name": "Red Hat Enterprise Linux 7 Server (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os/",
          "basearch": ["x86_64"],
          "releasever": ["7Server", "7.4"]
        },
        "rhel-7-server-optional-rpms": {
          "name": "Red Hat Enterprise Linux 7 Server - Optional (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/os/",
          "basearch": ["x86_64"],
          "releasever": ["7Server", "7.4"]
        },
        "rhel-6-server-rpms": {
          "name": "Red Hat Enterprise Linux 6 Server (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/os/",
          "basearch": ["x86_64"],
          "releasever": ["6Server", "6.9"]
        },
        "rhel-6-server-optional-rpms": {
          "name": "Red Hat Enterprise Linux 6 Server - Optional (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/optional/os/",
          "basearch": ["x86_64"],
          "releasever": ["6Server", "6.9"]
        }
      }
    },
    "Red Hat Enterprise Linux Workstation": {
      "redhat_eng_product_id": 71,
      "content_sets": {
        "rhel-7-workstation-rpms": {
          "name": "Red Hat Enterprise Linux 7 Workstation (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/workstation/7/$releasever/$basearch/os/",
          "basearch": ["x86_64"],
          "releasever": ["7Workstation", "7.4"]
        },
        "rhel-7-workstation-optional-rpms": {
          "name": "Red Hat Enterprise Linux 7 Workstation - Optional (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/workstation/7/$releasever/$basearch/optional/os/",
          "basearch": ["x86_64"],
          "releasever": ["7Workstation", "7.4"]
        },
        "rhel-6-workstation-rpms": {
          "name": "Red Hat Enterprise Linux 6 Workstation (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/workstation/6/$releasever/$basearch/os/",
          "basearch": ["x86_64"],
          "releasever": ["6Workstation", "6.9"]
        },
        "rhel-6-workstation-optional-rpms": {
          "name": "Red Hat Enterprise Linux 6 Workstation - Optional (RPMs)",
          "baseurl": "https://cdn.redhat.com/content/dist/rhel/workstation/6/$releasever/$basearch/optional/os/",
          "basearch": ["x86_64"],
          "releasever": ["6Workstation", "6.9"]
        }
      }
    }
  }
},
{
  "products": {
    "Fedora": {
      "content_sets": {
        "updates": {
          "name": "Fedora Updates",
          "baseurl": "https://mirrors.nic.cz/fedora/linux/updates/$releasever/$basearch/",
          "basearch": ["x86_64"],
          "releasever": ["27"]
        }
      }
    }
  }
}]
Clone this wiki locally