SSH Server
- POST
- /workspaces
- /:workspace
- /targets
Create a new SSH Server deployment target
Examples
SSH Target (SSH_KEY)SSH Target (PASSWORD)SSH Target (SSH_KEY without passphrase)SSH Target (SSH_KEY with passphrase)
Example: SSH Target (SSH_KEY)
curl -X POST "https://api.buddy.works/workspaces/:workspace/targets" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "SSH",
"identifier": "production-web-server",
"name": "Production Web Server",
"host": "web.example.com",
"port": "22",
"path": "/var/www/html",
"auth": {
"method": "SSH_KEY",
"username": "deploy",
"key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----",
"passphrase": "keypassphrase"
},
"tags": [
"production",
"web",
"deploy"
],
"allPipelinesAllowed": false,
"allowedPipelines": [
{
"project": "my-project",
"pipeline": "deploy-pipeline"
},
{
"project": "my-project",
"pipeline": "hotfix-pipeline"
}
]
}'Example: SSH Target (PASSWORD)
curl -X POST "https://api.buddy.works/workspaces/:workspace/targets" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "SSH",
"identifier": "ssh-pipeline",
"name": "SSH Pipeline",
"host": "my-server.tests",
"port": "1234",
"path": "target/path/on/server",
"auth": {
"method": "PASSWORD",
"username": "my-user",
"password": "my-password"
},
"tags": [
"ssh",
"pipeline"
]
}'Example: SSH Target (SSH_KEY without passphrase)
curl -X POST "https://api.buddy.works/workspaces/:workspace/targets" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "SSH",
"identifier": "ssh-key-target",
"name": "SSH Key Target",
"host": "5.75.234.250",
"port": "22",
"auth": {
"method": "SSH_KEY",
"username": "sftp-key-0",
"key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----"
},
"tags": [
"ssh",
"key"
]
}'Example: SSH Target (SSH_KEY with passphrase)
curl -X POST "https://api.buddy.works/workspaces/:workspace/targets" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"type": "SSH",
"identifier": "ssh-key-passphrase-target",
"name": "SSH Key with Passphrase Target",
"host": "5.75.234.250",
"port": "22",
"auth": {
"method": "SSH_KEY",
"username": "sftp-pass-key-phrase-0",
"key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----",
"passphrase": "key-passphrase"
},
"tags": [
"ssh",
"key",
"passphrase"
]
}'EXAMPLE RESPONSE{ "url": "https://api.buddy.works/workspaces/my-workspace/targets/tg-12345", "html_url": "https://app.buddy.works/targets/tg-12345", "id": "tg-12345", "identifier": "production-web-server", "name": "Production Web Server", "type": "SSH", "host": "web.example.com", "port": "22", "path": "/var/www/html", "auth": { "method": "SSH_KEY", "username": "deploy", "asset": "production-ssh-key" }, "tags": [ "production", "web", "deploy" ], "allPipelinesAllowed": false, "allowedPipelines": [ { "project": "my-project", "pipeline": "deploy-pipeline" }, { "project": "my-project", "pipeline": "hotfix-pipeline" } ], "permissions": { "others": "READ_ONLY", "users": [ { "id": 42, "access_level": "USE_ONLY" } ], "groups": [] } }
STATUS201 Created