> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wistx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Infrastructure

> Manage infrastructure lifecycle (create, update, upgrade, backup, restore, monitor, optimize)

Manage infrastructure lifecycle operations including create, update, upgrade, backup, restore, monitor, and optimize.

<ParamField body="action" type="string" required>
  Action to perform: `create`, `update`, `upgrade`, `backup`, `restore`, `monitor`, `optimize`
</ParamField>

<ParamField body="infrastructure_type" type="string" required>
  Type of infrastructure: `kubernetes`, `multi_cloud`, `hybrid_cloud`
</ParamField>

<ParamField body="resource_name" type="string" required>
  Name of the resource/cluster
</ParamField>

<ParamField body="cloud_provider" type="string | string[]">
  Cloud provider(s) - single string or array for multi-cloud
</ParamField>

<ParamField body="configuration" type="object">
  Infrastructure configuration dictionary
</ParamField>

<ParamField body="compliance_standards" type="string[]">
  Compliance standards to enforce
</ParamField>

<ParamField body="current_version" type="string">
  Current version (required for upgrade action)
</ParamField>

<ParamField body="target_version" type="string">
  Target version (required for upgrade action)
</ParamField>

<ParamField body="backup_type" type="string" default="full">
  Type of backup: `full`, `incremental` (for backup action)
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.wistx.ai/v1/infrastructure/manage" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "create",
      "infrastructure_type": "kubernetes",
      "resource_name": "production-cluster",
      "cloud_provider": "aws",
      "configuration": {
        "node_count": 3,
        "instance_type": "m5.large"
      },
      "compliance_standards": ["PCI-DSS"]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.wistx.ai/v1/infrastructure/manage"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "action": "create",
      "infrastructure_type": "kubernetes",
      "resource_name": "production-cluster",
      "cloud_provider": "aws",
      "configuration": {
          "node_count": 3,
          "instance_type": "m5.large"
      },
      "compliance_standards": ["PCI-DSS"]
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.wistx.ai/v1/infrastructure/manage", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      action: "create",
      infrastructure_type: "kubernetes",
      resource_name: "production-cluster",
      cloud_provider: "aws",
      configuration: {
        node_count: 3,
        instance_type: "m5.large"
      },
      compliance_standards: ["PCI-DSS"]
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "net/http"
  )

  func main() {
      url := "https://api.wistx.ai/v1/infrastructure/manage"
      data := map[string]interface{}{
          "action": "create",
          "infrastructure_type": "kubernetes",
          "resource_name": "production-cluster",
          "cloud_provider": "aws",
          "configuration": map[string]interface{}{
              "node_count": 3,
              "instance_type": "m5.large",
          },
          "compliance_standards": []string{"PCI-DSS"},
      }
      
      jsonData, _ := json.Marshal(data)
      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
      req.Header.Set("Content-Type", "application/json")
      
      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'

  uri = URI('https://api.wistx.ai/v1/infrastructure/manage')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(uri.path)
  request['Authorization'] = 'Bearer YOUR_API_KEY'
  request['Content-Type'] = 'application/json'
  request.body = {
    action: "create",
    infrastructure_type: "kubernetes",
    resource_name: "production-cluster",
    cloud_provider: "aws",
    configuration: {
      node_count: 3,
      instance_type: "m5.large"
    },
    compliance_standards: ["PCI-DSS"]
  }.to_json

  response = http.request(request)
  puts response.body
  ```

  ```php PHP theme={null}
  <?php

  $url = "https://api.wistx.ai/v1/infrastructure/manage";
  $data = [
      "action" => "create",
      "infrastructure_type" => "kubernetes",
      "resource_name" => "production-cluster",
      "cloud_provider" => "aws",
      "configuration" => [
          "node_count" => 3,
          "instance_type" => "m5.large"
      ],
      "compliance_standards" => ["PCI-DSS"]
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer YOUR_API_KEY",
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);
  echo $response;
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;
  import java.nio.charset.StandardCharsets;

  HttpClient client = HttpClient.newHttpClient();
  String json = "{\"action\":\"create\",\"infrastructure_type\":\"kubernetes\",\"resource_name\":\"production-cluster\",\"cloud_provider\":\"aws\",\"configuration\":{\"node_count\":3,\"instance_type\":\"m5.large\"},\"compliance_standards\":[\"PCI-DSS\"]}";

  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.wistx.ai/v1/infrastructure/manage"))
      .header("Authorization", "Bearer YOUR_API_KEY")
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString(json))
      .build();

  HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```
</CodeGroup>

## Response Example

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "data": {
      "resource_id": "infra_abc123",
      "status": "created",
      "endpoints": [
        "https://production-cluster.example.com"
      ],
      "compliance_status": {
        "PCI-DSS": {
          "status": "compliant",
          "controls_passed": 45,
          "controls_total": 45
        }
      },
      "cost_summary": {
        "monthly_estimate": 500.0,
        "annual_estimate": 6000.0
      },
      "recommendations": [
        "Enable auto-scaling for cost optimization",
        "Use reserved instances for predictable workloads"
      ],
      "action_performed": "create"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123,
      "query_time_ms": 1500
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid request parameters",
      "details": "action, infrastructure_type, and resource_name are required"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": {
      "code": "UNAUTHORIZED",
      "message": "Invalid or expired token"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 429 Too Many Requests theme={null}
  {
    "error": {
      "code": "QUOTA_EXCEEDED",
      "message": "Query quota exceeded",
      "details": {
        "limit_type": "queries_per_month",
        "current": 1000,
        "limit": 1000
      }
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "error": {
      "code": "INTERNAL_ERROR",
      "message": "An unexpected error occurred"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 503 Service Unavailable theme={null}
  {
    "error": {
      "code": "DATABASE_ERROR",
      "message": "Database connection failed"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```
</ResponseExample>

## Rate Limits

* **Professional**: 2,000 queries/month
* **Team**: 10,000 queries/month
* **Enterprise**: Unlimited queries/month


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.