Pull Resources

Pull Resources

 

Introduction

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.

Note: If your working directory doesn't have an active Catalyst project associated with it, you will be unable to pull any resources. Make sure that you have initialized and associated the directory with a Catalyst project before pulling resources into it.
 

Pull All Resources

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.


 

Pull Functions

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.

 

Pull Client

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.

 

Pull API Gateway Rules

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.

Note: If you selected a resource to be pulled and it does not exist in the remote console, the CLI will throw an error. For example, if no APIs were created in the remote console, no API Gateway rules will be pulled.
 

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.


 

Pull a Specific Resource

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.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocatalyst.com