Complete API references

YaK API Reference Documentation

This document provides comprehensive API reference and practical examples for the YaK system.

Note: This documentation requires jq to be installed for parsing and formatting API responses. All example API calls use jq to process the output.

Table of Contents

GraphiQL UI Interface

In addition to using the curl commands provided in this document, you can also interact with the YAK API through the GraphiQL web interface, a powerful in-browser IDE for exploring GraphQL APIs.

Accessing GraphiQL

This URL opens the GraphiQL web interface for interactive API exploration (be aware of the 'i' in graphiql).

https://<yak_url>/data/graphiql

Features of GraphiQL

  • Interactive Query Builder: Write and execute queries in a user-friendly interface

  • Documentation Explorer: Browse the API schema, types, and available operations

  • Response Formatting: Results are displayed in a well-structured JSON format

Using GraphiQL

  1. Authentication: Before using GraphiQL, you need to authenticate into the yak via the login UI.

  2. Exploring the Schema: Click on the "Docs" button in the right sidebar to view available queries and mutations.

  3. Writing Queries: Type your GraphQL queries in the left pane, using auto-complete to help build valid requests.

  4. Executing Queries: Click the "Play" button to send the request to the server.

  5. Viewing Results: The response will appear in the right pane in a formatted JSON structure.

Environment Configuration

Before running the API calls in this documentation, configure these environment variables to simplify the commands.

Authentication Configuration

Project Configuration

Secrets Configuration

AWS Configuration

Azure Configuration

OCI Configuration

Authentication

This command authenticates the user and retrieves a token for API access. The token is stored in a environment variable called TOKEN which is used on others API calls examples.

Provider Image Management

This query retrieves the JSON schema which contains the definition of variables for Provider Image.

AWS Image Configuration

This mutation adds a new Provider Image into the YaK for AWS Linux.

This mutation adds a new Provider Image into the YaK for AWS Windows.

This mutation assigns the Linux Provider Image to a YaK project.

Users from the project can use the Provider Image.

This mutation assigns the Windows Provider Image to a YaK project.

Azure Image Configuration

This mutation adds a new Provider Image into the YaK for Azure Linux.

This mutation adds a new Provider Image into the YaK for Azure Windows.

This mutation assigns the Linux Provider Image to a YaK project.

Users from the project can use the Provider Image.

This mutation assigns the Windows Provider Image to a YaK project.

OCI Image Configuration

This mutation adds a new Provider Image into the YaK for OCI Linux.

This mutation adds a new Provider Image into the YaK for OCI Windows.

This mutation assigns the Linux Provider Image to a YaK project.

Users from the project can use the Provider Image.

This mutation assigns the Windows Provider Image to a YaK project.

Provider Shape Management

This query retrieves the JSON schema for Provider Shape variables.

AWS Shape Configuration

This mutation adds a new AWS shape into the YaK (Refer to AWS documentation to know the instance_type available).

This mutation assigns a shape to a YaK project.

Azure Shape Configuration

This mutation adds a new Azure Shape into the YaK. (Refer to the Azure documentation for the VM Size name).

This mutation assigns a shape to a YaK project.

OCI Shape Configuration

This mutation adds a new OCI shape to the YaK. (Refer to the official OCI documentation for Shape name and memory/ocpus values).

This mutation assigns a shape to a YaK project.

Secrets Management

This query lists all secret type parameters available in the YaK.

For examples, to only list variables for aws credentials, this command can be run.

Secret Creation

SSH Key Configuration

This mutation creates a secret of type ssh key.

WINRM Configuration

This mutation creates a secret of type winrm.

AWS Credentials Configuration

This mutation creates a secret of type aws credentials.

Azure Credentials Configuration

This mutation creates a secret of type azure credentials.

OCI Credentials Configuration

This mutation creates a secret of type oci credentials.

Secret Operations

Update Secret

This mutation updates an existing secret with new values.

Delete Secret

This mutation deletes a secret in the YaK.

Search Secrets

This query searches for secrets matching the wildcard searchTerm value.

Listing all secrets parameters from all providers

Listing all secrets parameters from all providers, whose secret name contains creds

Secret Attachment

Infrastructure Secret Attachment

This mutation attaches a secret to an YaK infrastructure.

This mutation detaches a secret from a YaK infrastructure.

Server Secret Attachment

This mutation attaches a secret to a server.

This mutation detaches a secret from a server.

Infrastructure Management

This query retrieves the JSON schema for infrastructure variables.

AWS Infrastructure

This mutation creates a new AWS infrastructure. Refer to the infrastructureVariables jsonb schema for pVariables.

Azure Infrastructure

This mutation creates a new Azure infrastructure. Refer to the infrastructureVariables jsonb schema for pVariables.

OCI Infrastructure

This mutation creates a new OCI infrastructure. Refer to the infrastructureVariables jsonb schema for pVariables.

On-Premises Infrastructure

This mutation creates a new on premise infrastructure. Refer to the infrastructureVariables jsonb schema for pVariables.

Infrastructure Operations

Update AWS Infrastructure

This mutation updates an existing AWS infrastructure. Refer to the infrastructureVariables jsonb schema for pVariables.

Search Infrastructures

This query searches for infrastructures matching the wildcard searchTerm.

List all existing infrastructure in the YaK

List all existing infrastructure in the YaK whose name contains infra

Delete infrastructure

This mutation deletes an infrastructure in the YaK.

Server Management

A server configuration has two jsonb variables pVariables and pProviderDisksParametersVariables.

This query retrieves the JSON schema for those variables.

Server Creation

Create Server AWS

This mutation creates a new AWS server.

Create OCI Server

This mutation creates a new OCI server.

Create Azure Server

This mutation creates a new Azure server.

Server Operations

Update OCI Server

This mutation updates an existing OCI server.

Delete OCI Server

This mutation deletes an OCI server from the YaK.

Delete AWS Server

This mutation deletes an AWS server from the YaK.

Search Servers

This query searches for servers matching the wildcard searchTerm value.

List all servers

List servers whose name contains az

List all AWS servers

Server Lifecycle Operations

pActionName value can be "deploy", "decommission", "start", "stop"

Deploy a Server

This mutation deploys a server by running the deploy action.

Deploy means provisionning and initializing the server.

Stop a Server

This mutation stops a server by running the stop action.

Start a Server

This mutation starts a server by running the start action.

Destroy a Server

This mutation destroys a server by running the decommission action.

Artifact Provider Management

This query retrieves the JSON schema for artifact provider variables.

Create Artifact Provider

This mutation creates a new artifact provider for AWS.

This mutation creates a new artifact provider for Azure.

This mutation creates a new artifact provider for OCI.

Update Artifact Provider

This mutation updates an existing artifact provider.

Search Artifact Providers

This query searches for artifact providers matching the wildcard searchTerm value.

List all artifact providers

#### List artifact providers whose name contains artifact

Delete Artifact Provider

This mutation deletes an artifact provider from the system.

Component Management

This section provides practical examples and step-by-step guidance for managing components in the YAK system via API calls.

Note: The component type you wish to use should already be uploaded into YAK.


Environment variable


Overview of Component Creation

Adding a component involves three main steps:

  1. Define the Component (Subcomponent)

  2. Assign Servers to Component Groups

  3. Configure Storage for Component Groups


1. Define the Component (Subcomponent)

To begin, you need to identify and define the subcomponent you want to create. For example, to work with Component type PostgreSQL, you may use subcomponents like pg_standalone or pg_ha.

  • Search for available subcomponents of a component type (e.g., postgresql_instance).

  • Retrieve variable specifications and group information for a specific subcomponent.

This query searches for available subcomponent types for a component type.

List all subcomponent

List all subcomponent variables

The following API call list all subcomponent whose name contains $SUBCOMPONENT_TYPE_NAME and linked to the component whose name is exactly $COMPONENT_TYPE_NAME.

It display in addition basicVariablesSpecifications advancedVariablesSpecifications groups, those will be needed to create the component.

Create a component

When creating a component, multiple parameters must be provided such as pBasicVariables, pAdvancedVariables. Refer to the API call searchVSubcomponentTypes to retrieve such information.


2. Assign Servers to Component Groups

Next, you need to assign servers to the component groups. This is done by specifying the servers in the pJsonInput.<group_name>.servers field.

Groups information such as their names are obtains from the api call searchVSubcomponentTypes.

  • Example: Assign $COMPONENT_SERVER to the postgresql_host group of the component.


3. Configure Storage for Component Groups

Next, configure the storage for each group. The required storage variables depend on the operating system and provider.

### Fetch variables and values for component storage

Default values provided by the components are obtained in the API call searchVSubcomponentTypes in the groups variable.

  • Tip: You can fetch the JSON schema componentStorageVariables using the provided query.

Update the component storage

The mutation componentStorageUpdate update the storage for each groups. Each server of a groups get its values from that.

Running Component Actions

To perform actions (such as deploy) on a component:

  1. Find the feature_name for your component.

    • Use the provided queries to retrieve the available features for your component.

  1. Run the desired action using the componentRunFeature mutation.


Deleting a Component

When you no longer need a component, you can delete it

Note: It doesn't delete the component deployed, only the component information from the yak.Note: If you really need to delete the component installed, check if the component provide a features for uninstallation.

Last updated