Farms / Farm Roles: Create
Description
Create a new Farm Role in a Farm. FarmRole and FarmRoleTemplate objects are acceptable.
HTTP Request
POST /api/v1beta0/user/envId/farms/farmId/farm-roles/
Parameters
Name | Required | Description | Location |
---|---|---|---|
envId integer |
Yes | The ID of the Environment scoping this request. |
path |
farmId integer |
Yes | The ID of a Farm object. |
path |
Request body
The JSON representation of a FarmRole object.
The body must be a valid FarmRole object. Example value:
{
"advancedConfiguration": {
"abortInitializationOnOrchestrationFailure": true,
"disableAgentHostnameManagement": true,
"disableAgentIptablesManagement": true,
"disableAgentNtpManagement": true,
"instanceName": "string",
"rebootAfterHostInit": true
},
"alias": "string",
"availabilityZones": [
"string"
],
"bootstrapping": {
"enabled": true,
"type": "BootstrapConfiguration"
},
"cloudFeatures": {
"type": "CloudFeatures"
},
"cloudLocation": "string",
"cloudPlatform": "ec2",
"instanceType": {
"id": "string"
},
"launchIndex": 1,
"networking": {
"hostname": {
"domainName": "string",
"type": "HostnameConfiguration"
},
"networks": [
{
"associatePublicIpAddress": true,
"cloudFeatures": {
"type": "NetworkCloudFeatures"
},
"id": "string",
"ipPool": {
"id": "string"
},
"primary": true,
"staticIpMap": [
{
"ipAddress": "string",
"serverIndex": 1,
"type": "GenericStaticIp"
}
],
"subnets": [
{
"id": "string"
}
]
}
],
"subnets": [
{
"id": "string"
}
]
},
"role": {
"deprecated": {},
"id": 1
},
"scaling": {
"considerSuspendedServers": "running",
"enabled": true,
"maxInstances": 1,
"minInstances": 1,
"scalingBehavior": "suspend-resume"
},
"security": {
"securityGroups": [
{
"id": "string",
"name": "string"
}
]
}
}
Successful Response (Status 201)
The JSON representation of a FarmRole object.
The API replies with a FarmRoleDetailsResponse object. Example response body:
{
"data": {
"advancedConfiguration": {
"abortInitializationOnOrchestrationFailure": true,
"disableAgentHostnameManagement": true,
"disableAgentIptablesManagement": true,
"disableAgentNtpManagement": true,
"instanceName": "string",
"rebootAfterHostInit": true
},
"alias": "string",
"availabilityZones": [
"string"
],
"bootstrapping": {
"enabled": true,
"type": "BootstrapConfiguration"
},
"cloudFeatures": {
"type": "CloudFeatures"
},
"cloudLocation": "string",
"cloudPlatform": "ec2",
"farm": {
"id": 1
},
"id": 1,
"instanceType": {
"id": "string"
},
"launchIndex": 1,
"networking": {
"hostname": {
"domainName": "string",
"type": "HostnameConfiguration"
},
"networks": [
{
"associatePublicIpAddress": true,
"cloudFeatures": {
"type": "NetworkCloudFeatures"
},
"id": "string",
"ipPool": {
"id": "string"
},
"primary": true,
"staticIpMap": [
{
"ipAddress": "string",
"serverIndex": 1,
"type": "GenericStaticIp"
}
],
"subnets": [
{
"id": "string"
}
]
}
],
"subnets": [
{
"id": "string",
"networkId": "string"
}
]
},
"role": {
"deprecated": {
"deprecated": "2013-01-01T12:34:56.789Z",
"replacement": {
"id": 1
}
},
"id": 1
},
"scaling": {
"considerSuspendedServers": "running",
"enabled": true,
"maxInstances": 1,
"minInstances": 1,
"rules": [
"string"
],
"scalingBehavior": "suspend-resume"
},
"security": {
"securityGroups": [
{
"id": "string",
"name": "string"
}
]
}
},
"errors": [
{
"code": "string",
"message": "string"
}
],
"meta": {
"sample": "string"
},
"warnings": [
{
"code": "string",
"message": "string"
}
]
}
Other Response Messages
HTTP Status Code | Reason | Response Model |
---|---|---|
400 | A client-side error was made. |
An ApiErrorResponse object |
401 | The request was not authenticated. |
An ApiErrorResponse object |
403 | Insufficient permissions. |
An ApiErrorResponse object |
404 | Resource not found. |
An ApiErrorResponse object |
409 | Conflict with current state. |
An ApiErrorResponse object |
422 | This request was well-formed but was rejected due to semantic errors. |
An ApiErrorResponse object |
500 | A server-side error occurred. |
An ApiErrorResponse object |
501 | This feature is not implemented in Scalr. |
An ApiErrorResponse object |
503 | The service is currently unavailable. |
An ApiErrorResponse object |