firewall-orchestrator icon indicating copy to clipboard operation
firewall-orchestrator copied to clipboard

Test and enhance FWO API for importing owners and their networks

Open tpurschke opened this issue 2 years ago • 0 comments

  • [x] use case 1: initially auto-create many owners for performance testing

insert mutation:

mutation addOwners($owners:[owner_insert_input!]!) {
  insert_owner(
    objects: $owners
  ) {
    returning {
      id
    }
  }
}

Variables:

{
  "owners": [
      {
        "name": "5",
        "recert_interval": 365,
        "dn":"x",
        "group_dn":"x",
        "app_id_external": "app-5",
        "owner_networks": {"data": [{"ip": "10.5.0.0/16"},{"ip": "10.9.0.0/16"}]}
      },
      {
        "name": "6",
        "recert_interval": 30,
        "dn":"x",
        "group_dn":"x",
        "app_id_external": "app-6",
        "owner_networks": {"data": [{"ip": "10.6.0.0/16"}]}
      },
      {
        "name": "7",
        "recert_interval": 90,
        "dn":"x",
        "group_dn":"x",
        "app_id_external": "app-7",
        "owner_networks": {"data": [{"ip": "10.7.0.0/16"}]}
      }
  ]
}
  • [x] add upsert mutation which does not re-add existing owners or their networks (see https://hasura.io/docs/latest/mutations/postgres/upsert/)
mutation addSingleOwner {
  insert_owner(
    objects: [
      {
        name: "sechs"
        recert_interval: 222
        dn: "a"
        group_dn: "b"
        app_id_external: "app-sechs"
        owner_networks: {
          data: [{ ip: "10.69.0.0/16" }, { ip: "10.9.0.0/16" }]
          on_conflict: {
            constraint: owner_network_ip_unique
            update_columns: [ip]
          }
        }
      }
    ]
    on_conflict: {
      constraint: owner_name_key
      update_columns: [recert_interval, dn, group_dn]
    }
  ) {
    returning {
      id
    }
  }
}
  • [ ] problem with checking multiple constraints (seeh ttps://github.com/hasura/graphql-engine/issues/4163)

tpurschke avatar Mar 03 '23 10:03 tpurschke