|
| 1 | += Deploy and Operate |
| 2 | + |
| 3 | +== Deploy a GraphQL Data API |
| 4 | + |
| 5 | + |
| 6 | +Deploying a GraphQL Data API requires you first to have completed the steps in xref::/aura-graphql-data-apis/prerequisites.adoc[Prerequisites]. Of particular importance is that you have: |
| 7 | + |
| 8 | +* The ID, username and password for the AuraDB |
| 9 | +* A file containing the type definitions |
| 10 | + |
| 11 | +You are now ready to create the GraphQL Data API with the Aura CLI. Substitute the values in `CAPITALS` to match your setup: |
| 12 | + |
| 13 | +[source, bash, indent=0] |
| 14 | +---- |
| 15 | +aura-cli data-api graphql create --name YOUR-FRIENDLY-NAME --instance-id YOUR-AURA-INSTANCE-ID --instance-username YOUR-AURA-INSTANCE-USER --instance-password YOUR-AURA-INSTANCE-PASSWORD --type-definitions-file |
| 16 | +FULL-PATH-TO-YOUR-TYPE-DEFS --await |
| 17 | +---- |
| 18 | + |
| 19 | +[NOTE] |
| 20 | +==== |
| 21 | +Make sure to record the API key shown in the response as it will not be displayed again. If the API key is lost, a new one can be created by following the steps to create a new API key auth provider in the xref::/aura-graphql-data-apis/authentication-providers.adoc[authentication provider] section |
| 22 | +==== |
| 23 | + |
| 24 | +There are other items of note in the response: |
| 25 | + |
| 26 | +* `id`: unique identifier for the GraphQL Data API |
| 27 | +* `status`: tells you if the GraphQL Data API is ready to receive requests |
| 28 | +* `url`: the connection address to access the Data API |
| 29 | + |
| 30 | +To check if the GraphQL Data API is ready for requests, use the Aura CLI again, changing `YOUR-AURA-INSTANCE-ID` for the ID of your aura instance. |
| 31 | + |
| 32 | +[source, bash, indent=0] |
| 33 | +---- |
| 34 | +aura-cli data-api graphql list --instance-id YOUR-AURA-INSTANCE-ID |
| 35 | +---- |
| 36 | + |
| 37 | +When the status changes to `ready`, the GraphQL Data API is available for servicing requests. |
| 38 | + |
| 39 | +== Modifying an Existing GraphQL Data API |
| 40 | + |
| 41 | +It is possible to change the configuration of an existing GraphQL Data API. The following properties can be modified: |
| 42 | + |
| 43 | +* Friendly name of the GraphQL Data API |
| 44 | +* Username and/or password for the associated Aura instance |
| 45 | +* Type definitions |
| 46 | + |
| 47 | +To do this, use the Aura CLI update command which requires IDs of the GraphQL Data API and it’s linked AuraDB instance. The format of this Aura CLI command is as follows: |
| 48 | + |
| 49 | +[source, bash, indent=0] |
| 50 | +---- |
| 51 | +aura-cli data-api graphql update YOUR-DATA-API-ID --instance-id YOUR-AURA-INSTANCE-ID <flags> |
| 52 | +---- |
| 53 | + |
| 54 | +As the change takes a few moments to fully implement, you should check the status of the GraphQL Data API after performing this operation; if the status is `updating` then the change is still being processed. When the change is committed, the status will return to `ready`. |
| 55 | + |
| 56 | + |
| 57 | +Additionally, it is possible to modify the authentication providers of a GraphQL Data APIs. More on what these are and how to do this xref::/aura-graphql-data-apis/authentication-providers.adoc[here]. |
| 58 | + |
| 59 | +== Deleting a GraphQL Data API |
| 60 | + |
| 61 | +When you no longer require the GraphQL Data API then delete it by using the Aura CLI delete command. This will require the Aura instance ID and ID of the GraphQL Data API. |
| 62 | + |
| 63 | +The format of this command is as follows: |
| 64 | + |
| 65 | +[source, bash, indent=0] |
| 66 | +---- |
| 67 | +aura-cli data-api graphql delete YOUR-DATA-API-ID --instance-id YOUR-AURA-INSTANCE-ID |
| 68 | +---- |
| 69 | + |
| 70 | +[NOTE] |
| 71 | +==== |
| 72 | +There is no additional confirmation - the GraphQL Data API will start to be deleted as soon as you press the Enter key! |
| 73 | +==== |
0 commit comments