Table of Contents:
You can pull the features from a Catalyst project that was created in the UI console to the CLI easily. This allows you to download the components of a project from the console, to the same project that is active in your working directory in the CLI. You can use this feature to update your project directory with the changes that were made in the console.
You can pull the three components of a Catalyst project: Client, Functions, API Gateway Rules. When you pull the client and function components, their respective home directories are created inside your working project directory. When you pull API Gateway rules, a JSON file that contains the definitions of the latest APIG rules will be pulled into your project's home directory. You can learn about the directory structure in detail from the Project Directory Structure help page.
To pull features from a Catalyst project to your CLI, navigate to the project directory where you want to pull the resources to, and execute the following command:
$ catalyst pull
This will initiate the pull process.
Select the resources that you want to pull. You can pull all three resources, or choose specific resources. Press Enter after selecting the resources.
If you selected Functions, select all the functions that you want to pull from your console to the project directory from the list. Press Enter after making the selection.
This will pull each function available in the console into its own directory in the functions directory of your project, in your local machine.
If you selected client, choose the client app version that you want to pull, from the list. The CLI displays all versions of your client application hosted in the remote console. Make the selection and press Enter.
The client files of the version you select will be pulled into the client directory of your project, in your local machine.
If you selected API Gateway Rules, a catalyst-user-rules.json file will be created in your project's home directory. The latest definitions created for all your APIs in the remote console will be written to this file. You can learn about this file from the Working with API Gateway CLI help page.
If API Gateway is disabled for your project in the remote console, Catalyst will ask you to enable it from the CLI before pulling the API definitions. Type Y and press Enter to enable API Gateway.
If API Gateway is enabled, the API definitions will be automatically pulled and added to the catalyst-user-rules.json file.
Catalyst will also update the catalyst.json file to include the information about the API Gateway rules JSON file.
Overwrite Existing Resources
If the function or the client directory, or the catalyst-user-rules.json file, does not exist in your project's root folder, they will be automatically created before the resources are pulled. However, if a resource is already present in your project folder, the CLI will ask you for confirmation to overwrite the existing file.
Type Y to overwrite the existing files, or N to decline, and press Enter. If you confirm the overwriting, the pull process will be initiated. If you decline, the pull process will be aborted.
You can pull a specific resource from your project in the following way:
$ catalyst pull [feature]
You must specify the keyword client, functions, or apig. For example, to pull functions alone, execute the following command from your project directory:
$ catalyst pull functions
This will list all the functions that you can pull into your directory. You can select and pull the required resources as discussed in the previous section.