Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/ROOT/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Generic Start
** xref:fleet-management/deployment-details.adoc[Deployment details]
** xref:fleet-management/procedures.adoc[Plugin procedures]
** xref:fleet-management/data.adoc[Data transparency]
** xref:fleet-management/aura-api.adoc[Aura API]
** xref:fleet-management/aura-cli.adoc[Aura CLI]

* xref:apoc.adoc[APOC support]

Expand Down
48 changes: 48 additions & 0 deletions modules/ROOT/pages/fleet-management/aura-api.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
= Aura API

This page describes how to use the Aura API to manage Fleet Manager resources programatically.

For instructions on how to use the Aura API, please reade the documentation at xref:api/overview.adoc[API Documentation]

The docs for the Aura API specs can be found at link:{neo4j-docs-base-uri}/aura/platform/api/specification/?urls.primaryName=Aura%20v2beta1[API Specification]

If you would rather manage the Fleet Manager resources through the Aura CLI, you can find instructions for that here xref:./aura-cli.adoc[Aura CLI documentation]

== Managing deploymments

The Aura API allows for the creation and deletion of deployments, fetching information about deployments and managing tokens for the deployments.

All steps in the document assume that you already have a running Neo4j database that you want to manage through Fleet Manager.

All endpoints start with a /organizations/:organization_id/projects/:project_id/, this will be left out for clarity and brevity.

Creating and registering a Fleet Manager deployment is done in three parts.

* Create a deployment.
** Send a post request to the `/deployments` endpoint supplying a `name` and an optional `connection_url` in the body. The response will hold the created deployment ID that will then be used when creating a token for the deployment.

[source, shell]
----
curl --request 'POST' https://api.neo4j.io/v2beta1/organizations/$YOUR_ORG_ID/projects/$YOUR_PROJECT_ID/deployments \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $YOUR_AURA_API_TOKEN" \
--data '{"connection_url": "$OPTIONAL_CONNECTION_URL", "name": "$DEPLOYMENT_NAME"}'
----

* Create a token for the deployment.
** Send a post request to the `/deployments/:deployment_id/token` endpoint. The token will be created as an auto rotating token with a three month rotation interval.

[source, shell]
----
curl --request 'POST' https://api.neo4j.io/v2beta1/organizations/$YOUR_ORG_ID/projects/$YOUR_PROJECT_ID/deployments/$DEPLOYMENT_ID/token \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $YOUR_AURA_API_TOKEN"
----

* Register the token to your Neo4j database.
** Connect to your Neo4j database and register the newly created token to the database with `call fleetManagement.registerToken('$TOKEN');`

* Refresh token
** If you need to rotate a token before the token rotates automatically, you can refresh the token by sending a PATCH request to the `/deployments/:deployment_id/token` endpoint.
51 changes: 51 additions & 0 deletions modules/ROOT/pages/fleet-management/aura-cli.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
= Aura CLI

This page describes how to manage Fleet Manager deployments through the Aura CLI. For general instructions on how to use the cli, please read the xref:aura-cli/index.adoc[Aura CLI documentation].

The CLI has access to all of the same functionalities as the Aura API and requires you to have a valid Aura API key configured in the CLI.

Currently all Fleet Manager commands are still under the Aura API v2 beta branch so you need to set the CLI into beta mode with the following command `aura-cli config set beta-enabled true`.

The top level command for accessing Fleet Manager resources through the CLI is `deployment`. All commands have a help function to list the required arguments, required and optinal flags and all shorthands for the flags.

== Registering a new deployment

Registering a new deployment happens in three steps. The guide assumes that you already have a running Neo4j database that you want to register with Fleet Manager.

* Create a new deployment
** `aura-cli deployment create --name $DEPLOYMENT_NAME --connection_url $OPTIONAL_CONNECTION_URL --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Create a new token for the deployment. The token will be an auto rotating token with a three month rotation interval.
** `aura-cli deployment token create --deployment-id $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Register the deployment
** Connect to your Neo4j database and register the newly created token to the database with `call fleetManagement.registerToken('$TOKEN');`

== Fetching deployments

* List all deployments
** `aura-cli deployment list --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Get one deployment
** `aura-cli deployment get $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Get all databases for a deployment
** `aura-cli deployment database list --deployment-id $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Get all servers for a deployment
** `aura-cli deployment server list --deployment-id $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Get all databases for a deployment server
** `aura-cli deployment server database list --deployment-id $DEPLOYMENT_ID --server-id $SERVER_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

== Other useful commands

* Delete a deployment
** `aura-cli deployment delete $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Delete a deployment token
** `aura-cli deployment token delete --deployment-id $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`

* Refresh a deployment token
** `aura-cli deployment token update --deployment-id $DEPLOYMENT_ID --organization-id $YOUR_ORG_ID --project-id $YOUR_PROJECT_ID`
** After creating the new deployment token, register it into the same database with the `registerToken` call.