Tanzu Changes

This commit is contained in:
pratik
2025-10-20 23:25:13 -05:00
parent d81e80f273
commit b7405c644b
4 changed files with 371 additions and 27 deletions

142
README.md
View File

@@ -26,9 +26,9 @@ java -jar build/libs/cf-uploader-1.0.0.jar
The application will start on `http://localhost:8080`
## API Endpoint
## API Endpoints
### Deploy Application to Cloud Foundry
### 1. Deploy Application to Cloud Foundry
**Endpoint:** `POST /api/cf/deploy`
@@ -39,7 +39,7 @@ The application will start on `http://localhost:8080`
- `jarFile` (file): The Java application JAR file
- `manifest` (file): Cloud Foundry manifest.yml file
### Sample cURL Request
#### Sample cURL Request
```bash
curl -X POST http://localhost:8080/api/cf/deploy \
@@ -56,7 +56,7 @@ curl -X POST http://localhost:8080/api/cf/deploy \
-F 'manifest=@/path/to/manifest.yml'
```
### Sample Request with Skip SSL Validation
#### Sample Request with Skip SSL Validation
```bash
curl -X POST http://localhost:8080/api/cf/deploy \
@@ -73,6 +73,115 @@ curl -X POST http://localhost:8080/api/cf/deploy \
-F 'manifest=@./manifest.yml'
```
---
### 2. List Applications
**Endpoint:** `POST /api/cf/apps`
**Content-Type:** `application/json`
Lists all applications in the specified organization and space.
#### Sample cURL Request
```bash
curl -X POST http://localhost:8080/api/cf/apps \
-H "Content-Type: application/json" \
-d '{
"apiEndpoint": "https://api.cf.example.com",
"username": "your-username",
"password": "your-password",
"organization": "your-org",
"space": "your-space",
"appName": "",
"skipSslValidation": false
}'
```
---
### 3. List Routes
**Endpoint:** `POST /api/cf/routes`
**Content-Type:** `application/json`
Lists all routes in the specified organization and space.
#### Sample cURL Request
```bash
curl -X POST http://localhost:8080/api/cf/routes \
-H "Content-Type: application/json" \
-d '{
"apiEndpoint": "https://api.cf.example.com",
"username": "your-username",
"password": "your-password",
"organization": "your-org",
"space": "your-space",
"appName": "",
"skipSslValidation": false
}'
```
---
### 4. Get Application Details
**Endpoint:** `POST /api/cf/app/{appName}`
**Content-Type:** `application/json`
Gets detailed information about a specific application.
#### Sample cURL Request
```bash
curl -X POST http://localhost:8080/api/cf/app/my-app \
-H "Content-Type: application/json" \
-d '{
"apiEndpoint": "https://api.cf.example.com",
"username": "your-username",
"password": "your-password",
"organization": "your-org",
"space": "your-space",
"appName": "",
"skipSslValidation": false
}'
```
---
### 5. Get Application Logs
**Endpoint:** `POST /api/cf/logs/{appName}?recent=true`
**Content-Type:** `application/json`
**Query Parameters:**
- `recent` (optional, default: `true`): If true, gets recent logs; if false, tails logs
Gets logs for a specific application.
#### Sample cURL Request (Recent Logs)
```bash
curl -X POST "http://localhost:8080/api/cf/logs/my-app?recent=true" \
-H "Content-Type: application/json" \
-d '{
"apiEndpoint": "https://api.cf.example.com",
"username": "your-username",
"password": "your-password",
"organization": "your-org",
"space": "your-space",
"appName": "",
"skipSslValidation": false
}'
```
---
### Sample Manifest File (manifest.yml)
```yaml
@@ -88,7 +197,9 @@ applications:
SPRING_PROFILES_ACTIVE: production
```
## Request Parameters
## Common Request Parameters
All endpoints require the following CF credentials and target information:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
@@ -97,9 +208,11 @@ applications:
| `password` | String | Yes | CF password |
| `organization` | String | Yes | Target CF organization |
| `space` | String | Yes | Target CF space |
| `appName` | String | Yes | Application name |
| `appName` | String | No* | Application name (required only for `/deploy` endpoint) |
| `skipSslValidation` | Boolean | Yes | Skip SSL certificate validation |
**Note:** Even though `appName` is not used by utility endpoints (`/apps`, `/routes`, `/app/{appName}`, `/logs/{appName}`), it must still be included in the JSON request body (can be empty string). The organization and space determine which apps/routes are listed or queried.
## Response Format
### Success Response
@@ -147,13 +260,16 @@ cf.cli.path=
## Features
- RESTful API for CF deployments
- Automatic CF CLI binary management (Linux, macOS, Windows)
- Secure password handling (masked in logs)
- Configurable timeout for long-running deployments
- Comprehensive error handling
- Multipart file upload support up to 500MB
- Automatic cleanup of temporary files
- **Application Deployment**: Deploy JAR files to Cloud Foundry with manifest support
- **Application Management**: List apps, view details, and access logs
- **Route Management**: List all routes in your CF space
- **Automatic CF CLI Management**: Bundled CF CLI binaries for Linux, macOS, and Windows
- **Secure Password Handling**: Passwords are masked in all log output
- **Comprehensive Logging**: Detailed DEBUG-level logging for troubleshooting deployments
- **Configurable Timeouts**: Adjustable timeout for long-running deployments (default: 600s)
- **Large File Support**: Multipart file upload support up to 500MB
- **Automatic Cleanup**: Temporary files are automatically cleaned up after operations
- **Error Handling**: Comprehensive exception handling with detailed error messages
## Error Handling