🆕 Documentation for the create
Command – Cuemby CLI
The create
command allows you to register or create new resources in the Cuemby platform using the CLI (cpctl
), specifying the type of resource (module) and the necessary parameters.
🔧 General Usage
cpctl create <module> [flags]
<module>
: Type of resource to create (project
,template
,environment
,integration
,runtime
)--project, -p
: Project name to associate the resource with (when applicable)--environment, -e
: Environment name (required forruntime
)--file, -f
: Path to the YAML file defining the resource
📦 Supported Modules
project
cpctl create project -f project.yaml
Description: Creates a new project.
Requires: YAML file with fields like name
, description
, etc.
template
cpctl create template -p <project_name> -f template.yaml
Requires: --project
and a YAML file defining the template.
environment
cpctl create environment -p <project_name> -f environment.yaml
Requires: --project
and a YAML file defining the environment.
integration
cpctl create integration -p <project_name> -f integration.yaml
Requires: --project
and a YAML file with integration parameters.
runtime
cpctl create runtime -p <project_name> -e <environment_name> -f runtime.yaml
Requires: --project
, --environment
, and a YAML file defining the runtime.
⚠️ Validations and Errors
Each module validates the presence of required flags and YAML content:
Module | --project | --environment | --file |
---|---|---|---|
project | ❌ | ❌ | ✅ |
template | ✅ | ❌ | ✅ |
environment | ✅ | ❌ | ✅ |
integration | ✅ | ❌ | ✅ |
runtime | ✅ | ✅ | ✅ |
Common error messages:
Please provide a project name with the -p flag
Please provide an environment name with the -e flag
YAML file is missing or unreadable
🗂️ Expected YAML File Structure
Basic example of a template.yaml
file:
name: nodejs-template
description: Template for Node.js services
project_id: my-project
🛠️ Command Registration and Flags
rootCmd.AddCommand(createCmd)
Flag definitions:
createCmd.Flags().StringVarP(&projectNameCreate, "project", "p", "", "Project name")
createCmd.Flags().StringVarP(&environmentNameCreate, "environment", "e", "", "Environment name")
createCmd.Flags().StringVarP(&yamlPath, "file", "f", "", "Path to YAML definition file")
📚 Dependencies
github.com/spf13/cobra
: CLI frameworkgithub.com/cuemby/cli/pkg/api
: Resource creation logicgopkg.in/yaml.v2
: YAML parsingos
,fmt
,io/ioutil
: File reading and error handling
✅ Full Example
cpctl create template -p onboarding -f ./templates/node.yaml
This command creates a new template in the onboarding
project using the definition in the node.yaml
file.