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

export GRAPHQL_URL="https://<yak_url>/data/graphql"
export YAK_USERNAME="admin"
export YAK_PASSWORD="yakpassword"

Project Configuration

export YAK_PROJECT="default"

Secrets Configuration

export SSH_SECRET_NAME="ssh-key-import-api"

export SSH_PRIVATE_KEY="-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn\nNhAAAAAwEAAQAAAgEAvi8js5IuuLziVcOQV+O0Z3fMjy9QJg6QALNtTfR3P+/IdJH3RSUf\n4Zbug4pTqu0kcJCNS8R7wlW2qJTI7pH1ImIS+7mLA3HQj2WtBYO0KMGx/KSRJ2ldgUqG2R\n9zyDPymDxRCojLOzxbD4Y/cs0JRO5ToP20mA63gBWxw3oYGpbOVpdDihSpMMUlsxXvx5w+\n6qeE5AjJC5RXsGW2YLqbSemFNk+Z1T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wZ1guPKu3JG+c7CkJENx/4Be2gvN5kLGLWmhAxPdSEgqvk2\nyQzjiw4UezJNcYPEvkgWYHPduQIDAQABo2AwXjATBgNVHSUEDDAKBggrBgEFBQcD\nAjAoBgNVHREEITAfoB0GCisGAQQBgjcUAgOgDwwNa2tlQGxvY2FsaG9zdDAdBgNV\nHQ4EFgQUVEAEe4SgKCFsieqhAIMmeUoR6FMwDQYJKoZIhvcNAQELBQADggEBAC8s\nrVK6E51xpwzkgJMU/Z3o0M5Qp209stpAtSZ1ltkjvA/rUG3re/MMIAD3d9jMgP8n\nrqx8Z1hAZxF2TWaUaveuc3kXy86TepARp7k2Czund06Mk803kSU1k4OYzTk4d9xG\njBiYneLn5d+DKZFEz2T7niK13K4Ik5LMhv4qvBDvvf67COAd5/ZcHEAV0aaxjKxD\ngcd3kXqxEarSvA2Eky65vZqMLo6AP2TgfVSVrTPhCVhkQtkTGziJjJk+wruvmfMG\n4QrTqVnPMGZceYAMBtNbIka3UiiagMdME5nTNc/DgCdfMQvE2nbMHm6y457gMVZV\nKgX9QCwmw4WBEvg06fc=\n-----END CERTIFICATE-----"

export AWS_SECRET_NAME="aws-creds-import-api"
export AWS_ACCESS_KEY_ID="AKIAEXAMPLE123456789"
export AWS_SECRET_ACCESS_KEY="EXAMPLE123456789abcdefghijklmnopqrstuvwxyz"
export AWS_SESSION_TOKEN="EXAMPLE123456789abcdefghijklmnopqrstuvwxyz"

export AZURE_SECRET_NAME="azure-creds-api"
export AZURE_CLIENT_ID="00000000-0000-0000-0000-000000000000"
export AZURE_SECRET="ExampleSecret1234567890"
export AZURE_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000"
export AZURE_TENANT="00000000-0000-0000-0000-000000000000"

export OCI_SECRET_NAME="oci-creds-api"
export OCI_USER_KEY_FILE="-----BEGIN PRIVATE KEY-----\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n-----END PRIVATE KEY-----"
export OCI_USER_ID="ocid1.user.oc1..example1234567890"
export OCI_TENANCY="ocid1.tenancy.oc1..example1234567890"
export OCI_USER_FINGERPRINT="00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff"

AWS Configuration

# Image
export AWS_LINUX_IMAGE_NAME="RHEL-9-3-0_HVM-20240117-x86_64-49-Hourly2-GP3"
export AWS_LINUX_USER=ec2-user
export AWS_LINUX_AMI_ID="ami-0134dde2b68fe1b07"

export AWS_WIN_IMAGE_NAME=aws-windows-server-2019-english-full-base
export AWS_WIN_USER=Ansible
export AWS_WIN_AMI_NAME="Windows_Server-2019-English-Full-Base-*"
export AWS_WIN_AMI_OWNER_ID=801119661308

# Shape 
export AWS_SHAPE_NAME="aws-t3medium-shape"
export AWS_SHAPE_TYPE="t3.medium"

# Infrastructure
export AWS_INFRA_NAME="infra-aws-1"
export AWS_REGION="eu-central-1"
export AWS_SUBNET="subnet-0123456789abcdef0"
export AWS_SECURITY_GROUP="sg-0123456789abcdef0"
# Server
export AWS_SERVER_NAME="aws-server-1"
export AWS_PUBLIC_IP=null
export AWS_PUBLIC_IP_MODE="automatic"
export AWS_ADMIN_PUBLIC_ACCESS=true
export AWS_PRIVATE_IP=null
export AWS_PRIVATE_IP_MODE="automatic"

export AWS_ROOT_DISK_ENCRYPTED=true
export AWS_ROOT_DISK_SIZE=40
export AWS_ROOT_DISK_TYPE="gp3"

# Artifacts
export AWS_ARTIFACTS_PROVIDER_TYPE="aws_s3"
export AWS_ARTIFACTS_PROVIDER_NAME="aws-artifacts-provider"
export AWS_ARTIFACTS_BUCKET_NAME="test-yak-artifacts"
export AWS_ARTIFACTS_IS_DEFAULT=false

Azure Configuration

# Image
export AZURE_LINUX_IMAGE_NAME="azure-redhat-9-3"
export AZURE_LINUX_USER="azureuser"
export AZURE_LINUX_OFFER="rhel-raw"
export AZURE_LINUX_PUBLISHER="RedHat"
export AZURE_LINUX_SKU="9_3"
export AZURE_LINUX_VERSION="latest"

export AZURE_WIN_IMAGE_NAME="azure-windows-server-2019-datacenter"
export AZURE_WIN_USER="Ansible"
export AZURE_WIN_OFFER="WindowsServer"
export AZURE_WIN_PUBLISHER="MicrosoftWindowsServer"
export AZURE_WIN_SKU="2019-Datacenter"
export AZURE_WIN_VERSION="latest"

# Shape
export AZURE_SHAPE_NAME="azure-default-shape"
export AZURE_SHAPE_TYPE="Standard_B2ms"

# Infrastructure
export AZURE_INFRA_NAME="test-infra-azure-1"
export AZURE_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000"
export AZURE_RESOURCE_GROUP="test-yak-rg"
export AZURE_VNET="test-yak-network"
export AZURE_SUBNET="test-yak-subnet"
export AZURE_SECURITY_GROUP="test-yak-nsg"

# Server
export AZURE_SERVER_NAME="t-az-ol91-lvm-1"
export AZURE_PUBLIC_IP=null
export AZURE_PUBLIC_IP_MODE="automatic"
export AZURE_ADMIN_PUBLIC_ACCESS=true
export AZURE_PRIVATE_IP=null
export AZURE_PRIVATE_IP_MODE="automatic"
export AZURE_AVAILABILITY_ZONE="None"
export AZURE_ROOT_DISK_ENCRYPTION_AT_HOST=true
export AZURE_ROOT_DISK_TYPE="StandardSSD_LRS"
export AZURE_ROOT_DISK_CACHING="ReadWrite"
export AZURE_ROOT_DISK_SIZE="35"


# Artifacts Provider Configuration
export AZURE_ARTIFACTS_PROVIDER_NAME="azure-artifacts-provider"
export AZURE_ARTIFACTS_IS_DEFAULT=true
export AZURE_ARTIFACTS_PROVIDER_TYPE="azure_storageblob"
export AZURE_ARTIFACTS_RESOURCE_GROUP="test-yak-rg"
export AZURE_ARTIFACTS_CONTAINER="test-yak-artifacts"
export AZURE_ARTIFACTS_STORAGE_ACCOUNT="testyakartifacts"

OCI Configuration

# Image
export OCI_LINUX_IMAGE_NAME="Oracle-Linux-9-3-20240422"
export OCI_LINUX_USER="opc"
export OCI_LINUX_IMAGE_ID="ocid1.image.oc1.eu-zurich-1.aaaaaaaafaqxxnzbnh74vcz36qzz3xqxoi56auo6xlzexkov4575zoyrtnpq"
export OCI_REGION="eu-zurich-1"

export OCI_WIN_IMAGE_NAME="win-server-2022-standard-edition-vm-2024-05-14-0"
export OCI_WIN_USER="Ansible"
export OCI_WIN_IMAGE_ID="ocid1.image.oc1.eu-zurich-1.aaaaaaaaycrmwstc2wabaftuv2yln27dwgqo6bygswwpjephgrtfqdjz4tfq"

# Shape
export OCI_SHAPE_NAME="oci-default-shape"
export OCI_SHAPE_GBS=8
export OCI_SHAPE_TYPE="VM.Standard3.Flex"
export OCI_SHAPE_OCPUS=2

# Infrastructure
export OCI_INFRA_NAME="test-infra-oci-1"
export OCI_REGION="eu-zurich-1"
export OCI_COMPARTMENT_ID="ocid1.compartment.oc1..aaaaaaaaexample1234567890"
export OCI_AVAILABILITY_DOMAIN="AlWD:EU-ZURICH-1-AD-1"
export OCI_SECURITY_LIST="ocid1.securitylist.oc1.eu-zurich-1.aaaaaaaaexample1234567890"
export OCI_SUBNET_ID="ocid1.subnet.oc1.eu-zurich-1.aaaaaaaaexample1234567890"

# Server
export OCI_SERVER_NAME="t-oci-ol93-1"
export OCI_PUBLIC_IP=null
export OCI_PUBLIC_IP_MODE="automatic"
export OCI_ADMIN_PUBLIC_ACCESS=true
export OCI_PRIVATE_IP=\"192.168.0.10\"
export OCI_PRIVATE_IP_MODE="manual"

# Disk Configuration
export OCI_ROOT_DISK_ENCRYPTION_IN_TRANSIT=true
export OCI_ROOT_DISK_TYPE="Balanced"
export OCI_ROOT_DISK_SIZE="50"

# Artifacts Provider Configuration
export OCI_ARTIFACTS_PROVIDER_NAME="oci-artifacts-provider"
export OCI_ARTIFACTS_IS_DEFAULT=false
export OCI_ARTIFACTS_PROVIDER_TYPE="oci_object_storage"
export OCI_ARTIFACTS_BUCKET_NAME="test-yak-artifacts"
export OCI_ARTIFACTS_NAMESPACE="testnamespace123"

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.

# Login and save token
export TOKEN=$(curl -k -X POST -H "Content-Type: application/json" \
-d "{\"query\":\"mutation { loginApi(input: {pPassword: \\\"$YAK_PASSWORD\\\", pUsername: \\\"$YAK_USERNAME\\\"}) { clientMutationId string } }\"}" \
$GRAPHQL_URL | jq -r '.data.loginApi.string')

Provider Image Management

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

# For the pVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"providerImageVariables\") { edges { node { name schema } } } }"
}' | jq

AWS Image Configuration

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pProviderName": "aws",
              "pProviderImageName":"'$AWS_LINUX_IMAGE_NAME'",
              "pOperatingSystemTypeName": "Linux",
              "pAnsibleUser": "'$AWS_LINUX_USER'",
              "pVariables": {
                  "ami_id": "'$AWS_LINUX_AMI_ID'",
                  "region_id": "'$AWS_REGION'"
              }
           }
       }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
       "variables": {
           "input": {
                "pProviderName": "aws",
                "pProviderImageName": "'$AWS_WIN_IMAGE_NAME'",
                "pOperatingSystemTypeName": "Windows",
                "pAnsibleUser": "'$AWS_WIN_USER'",
                "pVariables": {
                    "ami": {
                        "id": null, 
                        "name": "'$AWS_WIN_AMI_NAME'", 
                        "owner_id": '$AWS_WIN_AMI_OWNER_ID'
                    },
                    "region_id": "'$AWS_REGION'"
              }
           }
       }
}' | jq

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

Users from the project can use the Provider Image.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$AWS_LINUX_IMAGE_NAME'"
      }
    }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$AWS_WIN_IMAGE_NAME'"
      }
    }
}' | jq

Azure Image Configuration

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
  "variables": {
    "input": {
      "pProviderName": "azure",
      "pProviderImageName": "'$AZURE_LINUX_IMAGE_NAME'",
      "pOperatingSystemTypeName": "Linux",
      "pAnsibleUser": "'$AZURE_LINUX_USER'",
      "pVariables": {
        "image": {
          "offer": "'$AZURE_LINUX_OFFER'",
          "publisher": "'$AZURE_LINUX_PUBLISHER'",
          "sku": "'$AZURE_LINUX_SKU'",
          "version": "'$AZURE_LINUX_VERSION'"
        }
      }
    }
  }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
  "variables": {
    "input": {
      "pProviderName": "azure",
      "pProviderImageName": "'$AZURE_WIN_IMAGE_NAME'",
      "pOperatingSystemTypeName": "Windows",
      "pAnsibleUser": "'$AZURE_WIN_USER'",
      "pVariables": {
        "image": {
          "offer": "'$AZURE_WIN_OFFER'",
          "publisher": "'$AZURE_WIN_PUBLISHER'",
          "sku": "'$AZURE_WIN_SKU'",
          "version": "'$AZURE_WIN_VERSION'"
        }
      }
    }
  }
}' | jq

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

Users from the project can use the Provider Image.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$AZURE_LINUX_IMAGE_NAME'"
      }
    }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$AZURE_WIN_IMAGE_NAME'"
      }
    }
}' | jq

OCI Image Configuration

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
  "variables": {
    "input": {
      "pProviderName": "oci",
      "pProviderImageName": "'$OCI_LINUX_IMAGE_NAME'",
      "pOperatingSystemTypeName": "Linux",
      "pAnsibleUser": "'$OCI_LINUX_USER'",
      "pVariables": {
        "image_id": "'$OCI_LINUX_IMAGE_ID'",
        "region_id": "'$OCI_REGION'"
      }
    }
  }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation providerImageAdd($input: ProviderImageAddInput!) { providerImageAdd(input: $input) { integer } }",
  "variables": {
    "input": {
      "pProviderName": "oci",
      "pProviderImageName": "'$OCI_WIN_IMAGE_NAME'",
      "pOperatingSystemTypeName": "Windows",
      "pAnsibleUser": "'$OCI_WIN_USER'",
      "pVariables": {
        "image_id": "'$OCI_WIN_IMAGE_ID'",
        "region_id": "'$OCI_REGION'"
      }
    }
  }
}' | jq

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

Users from the project can use the Provider Image.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$OCI_LINUX_IMAGE_NAME'"
      }
    }
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignImageToProject($input: AssignImageToProjectInput!) { assignImageToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pImageName": "'$OCI_WIN_IMAGE_NAME'"
      }
    }
}' | jq

Provider Shape Management

This query retrieves the JSON schema for Provider Shape variables.

# For the pVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"providerShapeVariables\") { edges { node { name schema } } } }"
}' | jq

AWS Shape Configuration

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation providerShapeAdd($input: ProviderShapeAddInput!) { providerShapeAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pProviderShapeName": "'$AWS_SHAPE_NAME'",
              "pProviderName": "aws",
              "pVariables": {
                "instance_type": "'$AWS_SHAPE_TYPE'"
              }
           }
       }
}' | jq

This mutation assigns a shape to a YaK project.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignShapeToProject($input: AssignShapeToProjectInput!) { assignShapeToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pShapeName": "'$AWS_SHAPE_NAME'"
      }
    }
}' | jq

Azure Shape Configuration

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation providerShapeAdd($input: ProviderShapeAddInput!) { providerShapeAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pProviderShapeName": "'$AZURE_SHAPE_NAME'",
              "pProviderName": "azure",
              "pVariables": {
                "vm_size": "'$AZURE_SHAPE_TYPE'"
              }
           }
       }
}' | jq

This mutation assigns a shape to a YaK project.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignShapeToProject($input: AssignShapeToProjectInput!) { assignShapeToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pShapeName": "'$AZURE_SHAPE_NAME'"
      }
    }
}' | jq

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).

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation providerShapeAdd($input: ProviderShapeAddInput!) { providerShapeAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pProviderShapeName": "'$OCI_SHAPE_NAME'",
              "pProviderName": "oci",
              "pVariables": {
                "shape": {
                    "memory_in_gbs": '$OCI_SHAPE_GBS',
                    "name": "'$OCI_SHAPE_TYPE'",
                    "ocpus": '$OCI_SHAPE_OCPUS'
                }
              }
            }
        }
    }' | jq

This mutation assigns a shape to a YaK project.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation assignShapeToProject($input: AssignShapeToProjectInput!) { assignShapeToProject(input: $input) { clientMutationId } }",
    "variables": {
      "input": {
        "pProjectName": "'$YAK_PROJECT'",
        "pShapeName": "'$OCI_SHAPE_NAME'"
      }
    }
}' | jq

Secrets Management

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query":"{ vSecretTypeParameters { edges { node { secretTypeName variableName niceName usage dataType mandatory defaultValue options minLength maxLength regex } } } }"}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"query":"{ vSecretTypeParameters { edges { node { secretTypeName variableName niceName usage dataType mandatory defaultValue options minLength maxLength regex } } } }"}' | jq '[.data.vSecretTypeParameters.edges[].node | select(.secretTypeName == "aws credentials")]'

Secret Creation

SSH Key Configuration

This mutation creates a secret of type ssh key.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation secretAdd($input: SecretAddInput!) { secretAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "pSecretTypeName": "ssh key",
        "pSecretName": "'$SSH_SECRET_NAME'",
        "pSecretValues": [
          {"attribute": "PRIVATE_KEY", "value": "'$SSH_PRIVATE_KEY'" }
        ]
      }
    }
}' | jq

WINRM Configuration

This mutation creates a secret of type winrm.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
      "query": "mutation secretAdd($input: SecretAddInput!) { secretAdd(input: $input) { integer } }",
      "variables": {
        "input": {
          "pSecretTypeName": "winrm",
          "pSecretName": "'$WINRM_SECRET_NAME'",
          "pSecretValues": [
            {"attribute": "WINRM_CERTIFICATE_PRIVATE_KEY", "value": "'$WINRM_CERTIFICATE_PRIVATE_KEY'" },
            {"attribute": "WINRM_CERTIFICATE", "value": "'$WINRM_CERTIFICATE'" }
          ]
        }
      }
}' | jq

AWS Credentials Configuration

This mutation creates a secret of type aws credentials.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation secretAdd($input: SecretAddInput!) { secretAdd(input: $input) { integer } }",
        "variables": {
                "input": {
                  "pSecretTypeName": "aws credentials",
                  "pSecretName": "'$AWS_SECRET_NAME'",
                  "pSecretValues": [
                    { "attribute": "AWS_ACCESS_KEY_ID", "value": "'$AWS_ACCESS_KEY_ID'" },
                    { "attribute": "AWS_SECRET_ACCESS_KEY", "value": "'$AWS_SECRET_ACCESS_KEY'" },
                    { "attribute": "AWS_SESSION_TOKEN", "value": "'$AWS_SESSION_TOKEN'" }
                  ]
                }
        }
}' | jq

Azure Credentials Configuration

This mutation creates a secret of type azure credentials.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation secretAdd($input: SecretAddInput!) { secretAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "pSecretTypeName": "azure credentials",
        "pSecretName": "'$AZURE_SECRET_NAME'",
        "pSecretValues": [
          { "attribute": "AZURE_TENANT", "value": "'$AZURE_TENANT'" },
          { "attribute": "AZURE_SUBSCRIPTION_ID", "value": "'$AZURE_SUBSCRIPTION_ID'" },
          { "attribute": "AZURE_CLIENT_ID", "value": "'$AZURE_CLIENT_ID'" },
          { "attribute": "AZURE_SECRET", "value": "'$AZURE_SECRET'" }
        ]
      }
    }
}' | jq

OCI Credentials Configuration

This mutation creates a secret of type oci credentials.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation secretAdd($input: SecretAddInput!) { secretAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "pSecretTypeName": "oci credentials",
        "pSecretName": "'$OCI_SECRET_NAME'",
        "pSecretValues": [
          { "attribute": "OCI_USER_ID", "value": "'$OCI_USER_ID'" },
          { "attribute": "OCI_USER_FINGERPRINT", "value": "'$OCI_USER_FINGERPRINT'" },
          { "attribute": "OCI_TENANCY", "value": "'$OCI_TENANCY'" },
          { "attribute": "OCI_REGION", "value": "'$OCI_REGION'" },
          { "attribute": "OCI_USER_KEY_FILE", "value": "'$OCI_USER_KEY_FILE'" }
        ]
      }
    }
}' | jq

Secret Operations

Update Secret

This mutation updates an existing secret with new values.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation secretUpdate($input: SecretUpdateInput!) { secretUpdate(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pSecretName": "'$AWS_SECRET_NAME'",
      "pSecretValues": [
        { "attribute": "AWS_ACCESS_KEY_ID", "value": "'$AWS_ACCESS_KEY_ID'" },
        { "attribute": "AWS_SECRET_ACCESS_KEY", "value": "'$AWS_SECRET_ACCESS_KEY'" },
        { "attribute": "AWS_SESSION_TOKEN", "value": "'$AWS_SESSION_TOKEN'" }
      ]
    }
  }
}' | jq

Delete Secret

This mutation deletes a secret in the YaK.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation secretDelete($input: SecretDeleteInput!) { secretDelete(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pSecretName": '"$AWS_SECRET_NAME"'
    }
  }
}' | jq

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
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVSecrets { searchVSecrets(searchTerm: \"\", searchProviderName: \"\") { edges { node { id name typeId typeName providerId providerName serverAttachmentAllowed infrastructureAttachmentAllowed secretValues expirationTs } } } }"
}' | jq

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVSecrets { searchVSecrets(searchTerm: \"creds\", searchProviderName: \"\") { edges { node { id name typeId typeName providerId providerName serverAttachmentAllowed infrastructureAttachmentAllowed secretValues expirationTs } } } }"
}' | jq

Secret Attachment

Infrastructure Secret Attachment

This mutation attaches a secret to an YaK infrastructure.

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
      "query": "mutation infrastructureAttachSecret($input: InfrastructureAttachSecretInput!) { infrastructureAttachSecret(input: $input) { integer } }",
      "variables": {
          "input": {
            "pInfrastructureName": "'$AWS_INFRA_NAME'",
            "pSecretName": "'$AWS_SECRET_NAME'"
          }
      }
}' | jq

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
      "query": "mutation infrastructureAttachSecret($input: InfrastructureAttachSecretInput!) { infrastructureAttachSecret(input: $input) { integer } }",
      "variables": {
          "input": {
            "pInfrastructureName": "'$AZURE_INFRA_NAME'",
            "pSecretName": "'$AZURE_SECRET_NAME'"
          }
      }
}' | jq

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
      "query": "mutation infrastructureAttachSecret($input: InfrastructureAttachSecretInput!) { infrastructureAttachSecret(input: $input) { integer } }",
      "variables": {
          "input": {
            "pInfrastructureName": "'$OCI_INFRA_NAME'",
            "pSecretName": "'$OCI_SECRET_NAME'"
          }
      }
}' | jq

# To loop instead of doing individually call

# Array of infrastructure names
INFRA_NAMES=("$AWS_INFRA_NAME" "$AZURE_INFRA_NAME" "$OCI_INFRA_NAME")
# Array of secret types to attach
SECRET_NAMES=("$SSH_SECRET_NAME" "$WINRM_SECRET_NAME")

# Loop through each infrastructure name
for INFRA_NAME in "${INFRA_NAMES[@]}"; do
  # Loop through each secret type
  for SECRET_NAME in "${SECRET_NAMES[@]}"; do
    echo "Attaching secret '$SECRET_NAME' to infrastructure: $INFRA_NAME"
    
    # Make the curl request
    response=$(curl -k -s -X POST "$GRAPHQL_URL" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $TOKEN" \
      -d '{
           "query": "mutation infrastructureAttachSecret($input: InfrastructureAttachSecretInput!) { infrastructureAttachSecret(input: $input) { integer } }",
           "variables": {
               "input": {
                  "pInfrastructureName": "'"$INFRA_NAME"'",
                  "pSecretName": "'"$SECRET_NAME"'"
               }
           }
      }')
    done
done

This mutation detaches a secret from a YaK infrastructure.

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation infrastructureDetachSecret($input: InfrastructureDetachSecretInput!) { infrastructureDetachSecret(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pInfrastructureName": "'$AWS_INFRA_NAME'",
      "pSecretName": "'$AWS_SECRET_NAME'"
    }
  }
}' | jq

Server Secret Attachment

This mutation attaches a secret to a server.

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverAttachSecret($input: ServerAttachSecretInput!) { serverAttachSecret(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pServerName": "'$AWS_SERVER_NAME'",
      "pSecretName": "'$SSH_SECRET_NAME'"
    }
  }
}' | jq

This mutation detaches a secret from a server.

curl -k -s -X POST "$GRAPHQL_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverDetachSecret($input: ServerDetachSecretInput!) { serverDetachSecret(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pServerName": "'$AWS_SERVER_NAME'",
      "pSecretName": "'$SSH_SECRET_NAME'"
    }
  }
}' | jq

Infrastructure Management

This query retrieves the JSON schema for infrastructure variables.

# For the pVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"infrastructureVariables\") { edges { node { name schema } } } }"
}' | jq

AWS Infrastructure

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation infrastructureAdd($input: InfrastructureAddInput!) { infrastructureAdd(input: $input) { integer } }",
  "variables": {
    "input": {
      "pProviderName": "aws",
      "pInfrastructureName": "'$AWS_INFRA_NAME'",
      "pProjectName": "'$YAK_PROJECT'",
      "pVariables": {
        "region_id": "'$AWS_REGION'",
        "subnet_id": "'$AWS_SUBNET'",
        "security_group_id": "'$AWS_SECURITY_GROUP'",
        "custom_tags": {
          "Environment": "Test",
          "Department": "Development YaK",
          "Business_unit": "YaK"
        }
      }
    }
  }
}' | jq

Azure Infrastructure

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation infrastructureAdd($input: InfrastructureAddInput!) { infrastructureAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "pProviderName": "azure",
        "pInfrastructureName": "'$AZURE_INFRA_NAME'",
        "pProjectName": "'$YAK_PROJECT'",
        "pVariables": {
          "subscription_id": "'$AZURE_SUBSCRIPTION_ID'",
          "resource_group": "'$AZURE_RESOURCE_GROUP'",
          "virtual_network_name": "'$AZURE_VNET'",
          "subnet_name": "'$AZURE_SUBNET'",
          "security_group": "'$AZURE_SECURITY_GROUP'"
        }
      }
    }
}' | jq

OCI Infrastructure

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation infrastructureAdd($input: InfrastructureAddInput!) { infrastructureAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "pProviderName": "oci",
        "pInfrastructureName": "'$OCI_INFRA_NAME'",
        "pProjectName": "'$YAK_PROJECT'",
        "pVariables": {
          "region_id": "'$OCI_REGION'",
          "compartment_id": "'$OCI_COMPARTMENT_ID'",
          "availability_domain": "'$OCI_AVAILABILITY_DOMAIN'",
          "security_list": "'$OCI_SECURITY_LIST'",
          "subnet_id": "'$OCI_SUBNET_ID'"
        }
      }
    }
}' | jq

On-Premises Infrastructure

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation infrastructureAdd($input: InfrastructureAddInput!) { infrastructureAdd(input: $input) { integer } }",
    "variables": {
      "input": {
        "psProviderName": "on_premises",
        "pInfrastructureName": "onprem-infra-api",
        "pProjectName": "'$YAK_PROJECT'",
        "pVariables": {}
      }
    }
}' | jq

Infrastructure Operations

Update AWS Infrastructure

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation infrastructureUpdate($input: InfrastructureUpdateInput!) { infrastructureUpdate(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pInfrastructureName": "'$AWS_INFRA_NAME'",
      "pVariables": {
        "region_id": "'$AWS_REGION'",
        "subnet_id": "'$AWS_SUBNET'",
        "security_group_id": "'$AWS_SECURITY_GROUP'",
        "custom_tags": {
          "Environment": "Test",
          "Department": "Development YaK",
          "Business_unit": "YaK"
        }
      }
    }
  }
}' | jq

Search Infrastructures

This query searches for infrastructures matching the wildcard searchTerm.

List all existing infrastructure in the YaK

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVInfrastructures { searchVInfrastructures(searchTerm: \"\", searchProviderName: \"\") { edges { node { id name providerId providerName variables secrets hasAttachedServers projectName } } } }"
}' | jq

List all existing infrastructure in the YaK whose name contains infra

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVInfrastructures { searchVInfrastructures(searchTerm: \"infra\", searchProviderName: \"\") { edges { node { id name providerId providerName variables secrets hasAttachedServers projectName } } } }"
}' | jq

Delete infrastructure

This mutation deletes an infrastructure in the YaK.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation infrastructureDelete($input: InfrastructureDeleteInput!) { infrastructureDelete(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pInfrastructureName": "'$AWS_INFRA_NAME'"
    }
  }
}' | jq

Server Management

A server configuration has two jsonb variables pVariables and pProviderDisksParametersVariables.

This query retrieves the JSON schema for those variables.

# For the pVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"serverVariables\") { edges { node { name schema } } } }"
}' | jq

# For the pProviderDisksParametersVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"providerDiskParametersRoot\") { edges { node { name schema } } } }"
}' | jq

Server Creation

Create Server AWS

This mutation creates a new AWS server.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation serverAdd($input: ServerAddInput!) { serverAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pInfrastructureName": "'$AWS_INFRA_NAME'",
              "pServerName": "'$AWS_SERVER_NAME'",
              "pShapeName": "'$AWS_SHAPE_NAME'",
              "pImageName": "'$AWS_LINUX_IMAGE_NAME'",
              "pAccessWithPublicIp": '$AWS_ADMIN_PUBLIC_ACCESS',
              "pPrivateIp": '$AWS_PRIVATE_IP',
              "pPrivateIpModeName": "'$AWS_PRIVATE_IP_MODE'",
              "pPublicIp": '$AWS_PUBLIC_IP',
              "pPublicIpModeName": "'$AWS_PUBLIC_IP_MODE'",
              "pProviderDisksParametersVariables": {
                "providerImageOsType": "Linux",
                "aws_root_disk_parameters": {
                  "encrypted": '$AWS_ROOT_DISK_ENCRYPTED', 
                  "volume_size": '$AWS_ROOT_DISK_SIZE',
                  "volume_type": "'$AWS_ROOT_DISK_TYPE'"
                }
              },
              "pVariables": {
                "providerImageName": "'$AWS_LINUX_IMAGE_NAME'",
                "providerShapeName": "'$AWS_SHAPE_NAME'"
              }
           }
        }
}' | jq

Create OCI Server

This mutation creates a new OCI server.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation serverAdd($input: ServerAddInput!) { serverAdd(input: $input) { integer } }",
    "variables": {
        "input": {
          "pInfrastructureName": "'$OCI_INFRA_NAME'",
          "pServerName": "'$OCI_SERVER_NAME'",
          "pShapeName": "'$OCI_SHAPE_NAME'",
          "pImageName": "'$OCI_LINUX_IMAGE_NAME'",
          "pAccessWithPublicIp": '$OCI_ADMIN_PUBLIC_ACCESS',
          "pPrivateIp": '$OCI_PRIVATE_IP',
          "pPrivateIpModeName": "'$OCI_PRIVATE_IP_MODE'",
          "pPublicIp": '$OCI_PUBLIC_IP',
          "pPublicIpModeName": "'$OCI_PUBLIC_IP_MODE'",
          "pProviderDisksParametersVariables": {
            "providerImageOsType": "Linux",
            "oci_root_disk_parameters": {
              "is_pv_encryption_in_transit_enabled": '$OCI_ROOT_DISK_ENCRYPTION_IN_TRANSIT', 
              "boot_volume_size_in_gbs": "'$OCI_ROOT_DISK_SIZE'",
              "volume_type": "'$OCI_ROOT_DISK_TYPE'"
            }
          },
          "pVariables": {
            "providerImageName": "'$OCI_LINUX_IMAGE_NAME'",
            "providerShapeName": "'$OCI_SHAPE_NAME'"
          }
        }
    }
}' | jq

Create Azure Server

This mutation creates a new Azure server.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "mutation serverAdd($input: ServerAddInput!) { serverAdd(input: $input) { integer } }",
       "variables": {
           "input": {
              "pInfrastructureName": "'$AZURE_INFRA_NAME'",
              "pServerName": "'$AZURE_SERVER_NAME'",
              "pShapeName": "'$AZURE_SHAPE_NAME'",
              "pImageName": "'$AZURE_LINUX_IMAGE_NAME'",
              "pAccessWithPublicIp": '$AZURE_ADMIN_PUBLIC_ACCESS',
              "pPrivateIp": '$AZURE_PRIVATE_IP',
              "pPrivateIpModeName": "'$AZURE_PRIVATE_IP_MODE'",
              "pPublicIp": '$AZURE_PUBLIC_IP',
              "pPublicIpModeName": "'$AZURE_PUBLIC_IP_MODE'",
              "pProviderDisksParametersVariables": {
                "providerImageOsType": "Linux",
                "azure_root_disk_parameters": {
                  "encryption_at_host": '$AZURE_ROOT_DISK_ENCRYPTION_AT_HOST', 
                  "managed_disk_type": "'$AZURE_ROOT_DISK_TYPE'",
                  "os_disk_caching": "'$AZURE_ROOT_DISK_CACHING'",
                  "os_disk_size_gb": "'$AZURE_ROOT_DISK_SIZE'"
                }
              },
              "pVariables": {
                "providerImageName": "'$AZURE_LINUX_IMAGE_NAME'",
                "providerShapeName": "'$AZURE_SHAPE_NAME'",
                "availability_zones": "'$AZURE_AVAILABILITY_ZONE'"
              }
           }
        }
}' | jq

Server Operations

Update OCI Server

This mutation updates an existing OCI server.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverUpdate($input: ServerUpdateInput!) { serverUpdate(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pServerName": "'$OCI_SERVER_NAME'",
      "pShapeName": "'$OCI_SHAPE_NAME'",
      "pImageName": "'$OCI_LINUX_IMAGE_NAME'",
      "pAccessWithPublicIp": '$OCI_ADMIN_PUBLIC_ACCESS',
      "pPrivateIp": '$OCI_PRIVATE_IP',
      "pPrivateIpModeName": "'$OCI_PRIVATE_IP_MODE'",
      "pPublicIp": '$OCI_PUBLIC_IP',
      "pPublicIpModeName": "'$OCI_PUBLIC_IP_MODE'",
      "pProviderDisksParametersVariables": {
        "providerImageOsType": "Linux",
        "oci_root_disk_parameters": {
          "is_pv_encryption_in_transit_enabled": '$OCI_ROOT_DISK_ENCRYPTION_IN_TRANSIT', 
          "boot_volume_size_in_gbs": "'$OCI_ROOT_DISK_SIZE'",
          "volume_type": "'$OCI_ROOT_DISK_TYPE'"
        }
      },
      "pVariables": {
        "providerImageName": "'$OCI_LINUX_IMAGE_NAME'",
        "providerShapeName": "'$OCI_SHAPE_NAME'"
      }
    }
  }
}' | jq

Delete OCI Server

This mutation deletes an OCI server from the YaK.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation serverDelete($input: ServerDeleteInput!) { serverDelete(input: $input) { clientMutationId } }",
    "variables": {
        "input": {
          "pServerName": "'$OCI_SERVER_NAME'"
        }
    }
}' | jq

Delete AWS Server

This mutation deletes an AWS server from the YaK.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
    "query": "mutation serverDelete($input: ServerDeleteInput!) { serverDelete(input: $input) { clientMutationId } }",
    "variables": {
        "input": {
          "pServerName": "'$AWS_SERVER_NAME'"
        }
    }
}' | jq

Search Servers

This query searches for servers matching the wildcard searchTerm value.

List all servers

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVServers { searchVServers(searchTerm: \"\", searchProviderName: \"\") { edges { node { id name variables providerDisksParametersVariables serverStateId serverState providerShapeId providerShapeName providerShapeVariables providerImageId providerImageName providerImageAnsibleUser providerImageVariables providerImageOsType infrastructureId infrastructureName projectName providerId providerName adminAccessIp adminAccessPrivateKey secrets ips } } } }"
}' | jq

List servers whose name contains az

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVServers { searchVServers(searchTerm: \"az\", searchProviderName: \"\") { edges { node { id name variables providerDisksParametersVariables serverStateId serverState providerShapeId providerShapeName providerShapeVariables providerImageId providerImageName providerImageAnsibleUser providerImageVariables providerImageOsType infrastructureId infrastructureName projectName providerId providerName adminAccessIp adminAccessPrivateKey secrets ips } } } }"
}' | jq

List all AWS servers

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVServers { searchVServers(searchTerm: \"az\", searchProviderName: \"aws\") { edges { node { id name variables providerDisksParametersVariables serverStateId serverState providerShapeId providerShapeName providerShapeVariables providerImageId providerImageName providerImageAnsibleUser providerImageVariables providerImageOsType infrastructureId infrastructureName projectName providerId providerName adminAccessIp adminAccessPrivateKey secrets ips } } } }"
}' | jq

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverRunAction($input: ServerRunActionInput!) { serverRunAction(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pActionName": "deploy",
      "pServerName": "'$OCI_SERVER_NAME'",
      "pDebug": false
    }
  }
}' | jq

Stop a Server

This mutation stops a server by running the stop action.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverRunAction($input: ServerRunActionInput!) { serverRunAction(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pActionName": "stop",
      "pServerName": "'$OCI_SERVER_NAME'",
      "pDebug": false
    }
  }
}' | jq

Start a Server

This mutation starts a server by running the start action.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverRunAction($input: ServerRunActionInput!) { serverRunAction(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pActionName": "start",
      "pServerName": "'$OCI_SERVER_NAME'",
      "pDebug": false
    }
  }
}' | jq

Destroy a Server

This mutation destroys a server by running the decommission action.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation serverRunAction($input: ServerRunActionInput!) { serverRunAction(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pActionName": "decommission",
      "pServerName": "'$OCI_SERVER_NAME'",
      "pDebug": false
    }
  }
}' | jq

Artifact Provider Management

This query retrieves the JSON schema for artifact provider variables.

# For the pVariables jsonb schema
curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"artifactsprovidervariables\") { edges { node { name schema } } } }"
}' | jq

Create Artifact Provider

This mutation creates a new artifact provider for AWS.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation artifactsProviderAdd($input: ArtifactsProviderAddInput!) { artifactsProviderAdd(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pProviderName": "aws",
      "pSecretName": "'$AWS_SECRET_NAME'",
      "pArtifactsProviderName": "'$AWS_ARTIFACTS_PROVIDER_NAME'",
      "pIsDefault": '$AWS_ARTIFACTS_IS_DEFAULT',
      "pVariables": {
        "artifacts": {
          "provider": "'$AWS_ARTIFACTS_PROVIDER_TYPE'",
          "variables": {
            "bucket_name": "'$AWS_ARTIFACTS_BUCKET_NAME'"
          }
        }
      }
    }
  }
}' | jq

This mutation creates a new artifact provider for Azure.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation artifactsProviderAdd($input: ArtifactsProviderAddInput!) { artifactsProviderAdd(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pProviderName": "azure",
      "pSecretName": "'$AZURE_SECRET_NAME'",
      "pArtifactsProviderName": "'$AZURE_ARTIFACTS_PROVIDER_NAME'",
      "pIsDefault": '$AZURE_ARTIFACTS_IS_DEFAULT',
      "pVariables": {
        "artifacts": {
          "provider": "'$AZURE_ARTIFACTS_PROVIDER_TYPE'",
          "variables": {
            "resource_group": "'$AZURE_ARTIFACTS_RESOURCE_GROUP'",
            "container": "'$AZURE_ARTIFACTS_CONTAINER'",
            "storage_account_name": "'$AZURE_ARTIFACTS_STORAGE_ACCOUNT'"
          }
        }
      }
    }
  }
}' | jq

This mutation creates a new artifact provider for OCI.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation artifactsProviderAdd($input: ArtifactsProviderAddInput!) { artifactsProviderAdd(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pProviderName": "oci",
      "pSecretName": "'$OCI_SECRET_NAME'",
      "pArtifactsProviderName": "'$OCI_ARTIFACTS_PROVIDER_NAME'",
      "pIsDefault": '$OCI_ARTIFACTS_IS_DEFAULT',
      "pVariables": {
        "artifacts": {
          "provider": "'$OCI_ARTIFACTS_PROVIDER_TYPE'",
          "variables": {
            "namespace_name": "'$OCI_ARTIFACTS_NAMESPACE'",
            "bucket_name": "'$OCI_ARTIFACTS_BUCKET_NAME'"
          }
        }
      }
    }
  }
}' | jq

Update Artifact Provider

This mutation updates an existing artifact provider.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation artifactsProvidersUpdate($input: ArtifactsProvidersUpdateInput!) { artifactsProvidersUpdate(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pSecretName": "'$AWS_SECRET_NAME'",
      "pArtifactsProviderName": "'$AWS_ARTIFACTS_PROVIDER_NAME'",
      "pIsDefault": '$AWS_ARTIFACTS_IS_DEFAULT',
      "pVariables": {
        "artifacts": {
          "provider": "'$AWS_ARTIFACTS_PROVIDER_TYPE'",
          "variables": {
            "bucket_name": "newvalue"
          }
        }
      }
    }
  }
}' | jq

Search Artifact Providers

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

List all artifact providers

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVArtifactsProviders { searchVArtifactsProviders(searchTerm: \"\", searchProviderName: \"\") { edges { node { id name providerId isDefault providerName secretId secretName variables } } } }"
}' | jq

#### List artifact providers whose name contains artifact

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVArtifactsProviders { searchVArtifactsProviders(searchTerm: \"artifact\", searchProviderName: \"\") { edges { node { id name providerId isDefault providerName secretId secretName variables } } } }"
}' | jq

Delete Artifact Provider

This mutation deletes an artifact provider from the system.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation artifactsProviderDelete($input: ArtifactsProviderDeleteInput!) { artifactsProviderDelete(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pArtifactsProviderName": "'$AWS_ARTIFACTS_PROVIDER_NAME'"
    }
  }
}' | jq

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

export COMPONENT_TYPE_NAME=postgresql_instance
export SUBCOMPONENT_TYPE_NAME=pg_standalone

export COMPONENT_NAME=postgresql_standalone_test
export COMPONENT_SERVER=t-aws-deb11-1

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVSubcomponentTypes { searchVSubcomponentTypes(searchTerm: \"\", searchComponentTypeName: \"\") { edges { node { id name componentTypeName  } } } }"
}' | jq

List all subcomponent of component type $COMPONENT_TYPE_NAME

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVSubcomponentTypes { searchVSubcomponentTypes(searchTerm: \"\", searchComponentTypeName: \"'$COMPONENT_TYPE_NAME'\") { edges { node { id name componentTypeName  } } } }"
}' | jq

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVSubcomponentTypes { searchVSubcomponentTypes(searchTerm: \"'$SUBCOMPONENT_TYPE_NAME'\", searchComponentTypeName: \"'$COMPONENT_TYPE_NAME'\") { edges { node { id name basicVariablesSpecifications advancedVariablesSpecifications groups version  } } } }"
}' | jq 

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation componentAdd($input: ComponentAddInput!) { componentAdd(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pComponentName": "'$COMPONENT_NAME'",
      "pComponentTypeName": "'$COMPONENT_TYPE_NAME'",
      "pSubcomponentTypeName": "'$SUBCOMPONENT_TYPE_NAME'",
      "pBasicVariables": {
        "apply_os_prereqs": true,
        "install_type": "bin",
        "instance_details": {
          "log_timezone": "Europe/Zurich",
          "name": "postgres",
          "port": "5432"
        },
        "version": "17.4"
      },
      "pAdvancedVariables": {
        "email_notifications": {
          "mail_from": "postgres@localhost.com",
          "mail_to": "dba_team@example.com,servicedesk@example.com",
          "smtp_server": "localhost"
        },
        "extensions_to_install": ["citus", "pgaudit", "pg_stat_statements", "pg_prewarm", "pg_trgm", "postgis", "timescaledb", "vector"],
        "mountpoint_arch": "/u90",
        "mountpoint_base": "/u01",
        "mountpoint_data": "/u02",
        "postgres_user_home": "/home/postgres",
        "with_root_privileges": true
      },
      "pProjectName": "'$YAK_PROJECT'"
    }
  }
}' | jq

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.

# For the pJsonInput, it is the groups

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation componentsServersSet($input: ComponentsServersSetInput!) { componentsServersSet(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pJsonInput": {
        "postgresql_host": {
          "servers": ["'$COMPONENT_SERVER'"]
        }
      },
      "pComponentName": "'$COMPONENT_NAME'"
    }
  }
}' | jq

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
       "query": "query searchVJsonbSpecifications { searchVJsonbSpecifications(searchTerm: \"componentStorageVariables\") { edges { node { name schema } } } }"
}' | jq

Update the component storage

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

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation componentStorageUpdate($input: ComponentStorageUpdateInput!) { componentStorageUpdate(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pComponentName": "'$COMPONENT_NAME'",
      "pSubcomponentTypeGroupName": "postgresql_host",
      "pOperatingSystemTypeName": "Linux",
      "pProviderName": "aws",
      "pStorageVariables": [
        {
          "encrypted": true,
          "filesystem_type": "xfs",
          "max_size_gb": 40,
          "mount_options": "noatime",
          "mount_point": "/u01",
          "size_gb": 40,
          "volume_type": "gp3"
        },
        {
          "encrypted": true,
          "filesystem_type": "xfs",
          "max_size_gb": 20,
          "mount_options": "noatime",
          "mount_point": "/u02",
          "size_gb": 20,
          "volume_type": "gp3"
        },
        {
          "encrypted": true,
          "filesystem_type": "xfs",
          "max_size_gb": 20,
          "mount_options": "noatime",
          "mount_point": "/u90",
          "size_gb": 20,
          "volume_type": "gp3"
        }
      ]
    }
  }
}' | jq

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVComponents { searchVComponents(searchTerm: \"'$COMPONENT_NAME'\") { edges { node { id uuid name componentTypeId subcomponentTypeId actionName actionStatusId basicVariables advancedVariables componentStateId projectId componentStateName componentTypeName componentTypeManifest subcomponentTypeName subcomponentTypeFeatures groupsServers projectName } } } }"
}' | jq

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "query searchVComponents { searchVComponents(searchTerm: \"'$COMPONENT_NAME'\") { edges { node { name subcomponentTypeFeatures } } } }"
}' | jq
  1. Run the desired action using the componentRunFeature mutation.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation componentRunFeature($input: ComponentRunFeatureInput!) { componentRunFeature(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pComponentName": "'$COMPONENT_NAME'",
      "pFeatureName": "deploy_standalone",
      "pFeatureVariables": {}
    }
  }
}' | jq

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.

curl -k -X POST $GRAPHQL_URL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
  "query": "mutation componentDelete($input: ComponentDeleteInput!) { componentDelete(input: $input) { clientMutationId } }",
  "variables": {
    "input": {
      "pComponentName": "'$COMPONENT_NAME'"
    }
  }
}' | jq

Last updated