주요 내용으로 건너뛰기

modules/ directory

Expected location: modules/ or <your organization>/modules/

The modules directory contains the modules with the configuration that the Cognite Toolkit reads. This directory must be named modules and located either in the directory you run the toolkit from or one level below. If you have it one level below, you must specify the parent directory with the --organization-dir/-o flag. You can also set the default_organization_dir key in the cdf.toml file.

The Cognite Toolkit searches the modules directory for modules. A module is a directory that contains a resource directory. A resource directory is a set of reserved names such as auth, data_models, files, functions, workflows, etc. See the official modules for a complete list.

In the example below, cdf_search is a module that contains the auth, data_models, and locations resource directories. Similarly, cdf_ingestion, cdf_pi, and cdf_sap_assets` are modules that contain their respective resource directories.

./modules/
├── cdf_ingestion/
│ ├── auth/
│ ├── data_models/
│ └── workflow/
├── industrial_tools/
│ └── cdf_search/
│ ├── auth/
│ ├── data_models/
│ └── locations/
└── sourcesystem/
├── cdf_pi/
│ ├── auth/
│ ├── extraction_pipeline/
│ ├── transformations/
│ └── workflows/
└── cdf_sap_assets/
├── auth/
├── data_models/
└── transformations/

You can have an arbitrary directory structure within the module directory if you only use the resource directories to define modules. In the example above, the cdf_ingestion module is a top-level module. cdf_search, cdf_pi, and cdf_sap_assets are organized in subdirectories.

Resource directories

The resource directories contain the configuration files that define the resources. The configuration files are in YAML format with the .yaml extension. The toolkit expects the configuration files to be in matching directories. For example, you must define resources related to data models in the data_models directory. This makes it predictable where to find the configuration files for a specific resource type.

data_models/
├── containers/
│ ├── asset.Container.yaml
│ └── equipment.Container.yaml
├── views/
│ ├── asset.View.yaml
│ └── equipment.View.yaml
├── schema.Space.yaml
└── model.Datamodel.yaml

You can have an arbitrary directory structure within the resource directories. The toolkit searches for all .yaml files and parses them based on their filename and the resource directory they're in.

To name the resource configuration files, use the format filename.ResourceType.yaml.

Where:

  • filename is a unique name to identify the resource.
  • ResourceType specifies what type of resource the file defines and is used by the toolkit to determine how to parse the file. ResourceType is case-insensitive.

The toolkit uses this naming standard for resource directories and resource types:

  • Resource directories: plural nouns, for example, data_models, files, functions, workflows, etc.
  • Resource types: singular nouns, for example, Container, View, Datamodel, File, Function, Workflow, etc.