Create Environment
POST https://infrahub-api.nexgencloud.com/v1/core/environments
Creates an environment—a container to organize your resources, including SSH key pairs, virtual machines, and volumes. To create your environment, provide your desired environment name, and region in the request body. To learn more about environments, click here.
Request body parameters
name string
Required
The name
of the environment being created.
Environments must have unique names, even if they are in different regions.
A string with a maximum length of 50 characters.
region string
Required
The geographic location of the data center where the environment is being created. Learn more about regions.
Possible enum values: NORWAY-1
, CANADA-1
Attributes of the Environment object
status boolean
Indicates the success or failure of the operation. In this case, it is set to true
, indicating that the environment has been created successfully.
message string
A message confirming the successful creation of the environment.
environment object
An object containing details about the created environment.
For descriptions of the fields within the environment
object returned in response to your request, please refer to the documentation here.
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/environments" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "string",
"region": "string"
}'
{
"status": true,
"message": "Environment is created successfully",
"environment": {
"id": 2,
"name": "development",
"region": "NORWAY-1",
"created_at": "2023-04-19T05:09:16"
}
}
Returns
This response indicates that the creation of your environment named development
in region NORWAY-1
has been successful. The environment object containing details on the created environment is returned if the request was successful, otherwise, an error is returned.