# edit

The cldkctl guard edit command allows you to modify the configuration of an existing Guard in your project. This command can be used to update fields such as the Guard name, namespace, endpoint selector, and traffic rules for ingress and egress. It supports both interactive modification and YAML-based editing.

## Usage

```
cldkctl guard edit [flags]
```

## Aliases

```
edit, modify
```

## Steps

Follow the steps below to run and view the result of this command:

1. Identify the Guard Name of the Guard you want to modify. You can find it in the Guard List section.
2. Run the following command in your terminal:

```
cldkctl guard edit --name <guard_name>
```

<figure><img src="/files/XpldDJxOpklfHdKesknG" alt=""><figcaption></figcaption></figure>

3. The Name and Namespace fields are displayed automatically and cannot be edited.
4. Update the Endpoint Selector field by entering one or more labels (key-value pairs), separated by commas

<figure><img src="/files/jX1GAfi1fySJTHWHJoZ2" alt=""><figcaption></figcaption></figure>

5. Choose whether to clear existing ingress and egress rules before adding new ones. Select Yes, clear to remove all existing rules or No, keep to retain the current rules.

<figure><img src="/files/jdCKKXT4oimVLjUmRQ33" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/mumCelD8s892pWwZfOXE" alt=""><figcaption></figcaption></figure>

6. Decide whether to add new rules, such as a new ingress or egress rule. Select Yes to define new rules or No to skip.

<figure><img src="/files/xwqirqHd2UplKrEKwImC" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/RpsQjXXFJsrxmrq3Snkc" alt=""><figcaption></figcaption></figure>

7. Choose whether to deny all unspecified incoming or outgoing traffic. Select Yes, deny to block all traffic not defined in the rules, or No, allow to permit unspecified traffic.

<figure><img src="/files/jHWCkNroEYaSG93iGPVP" alt=""><figcaption></figcaption></figure>

8. When prompted with the confirmation message, select Confirm & Update to apply the new configuration.

<figure><img src="/files/muHSf2DXW4JDS63pWjix" alt=""><figcaption></figcaption></figure>

9. Once the update is successful, the terminal displays the message “✔ Guard updated successfully!”.

## Flags

{% hint style="info" %}
This command supports global flags. Refer to the Global Flags section for details.
{% endhint %}

| Flag                   | Description                                          |
| ---------------------- | ---------------------------------------------------- |
| -f, --file string      | Path to a YAML file for creating or editing a Guard. |
| -h, --help             | Help for the guard edit command.                     |
| -n, --name string      | Specify the Guard name to edit.                      |
| -s, --namespace string | Specify the namespace.                               |
| --yaml                 | Enable YAML-based editing mode.                      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudeka.ai/cloudeka-api-list/command-reference/cldkctl-guard/edit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
