> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# secret_manager

# `prefect_gcp.secret_manager`

## Functions

### `acreate_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L32](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L32)</sup>

```python theme={null}
acreate_secret(secret_name: str, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Creates a secret in Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the created secret.

### `create_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L89](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L89)</sup>

```python theme={null}
create_secret(secret_name: str, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Creates a secret in Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the created secret.

### `aupdate_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L140](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L140)</sup>

```python theme={null}
aupdate_secret(secret_name: str, secret_value: Union[str, bytes], gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Updates a secret in Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `secret_value`: Desired value of the secret. Can be either `str` or `bytes`.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the updated secret.

### `update_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L198](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L198)</sup>

```python theme={null}
update_secret(secret_name: str, secret_value: Union[str, bytes], gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Updates a secret in Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `secret_value`: Desired value of the secret. Can be either `str` or `bytes`.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the updated secret.

### `aread_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L250](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L250)</sup>

```python theme={null}
aread_secret(secret_name: str, gcp_credentials: 'GcpCredentials', version_id: Union[str, int] = 'latest', timeout: float = 60, project: Optional[str] = None) -> str
```

Reads the value of a given secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `version_id`: Version number of the secret to use, or "latest".
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* Contents of the specified secret.

### `read_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L302](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L302)</sup>

```python theme={null}
read_secret(secret_name: str, gcp_credentials: 'GcpCredentials', version_id: Union[str, int] = 'latest', timeout: float = 60, project: Optional[str] = None) -> str
```

Reads the value of a given secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `version_id`: Version number of the secret to use, or "latest".
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* Contents of the specified secret.

### `adelete_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L349](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L349)</sup>

```python theme={null}
adelete_secret(secret_name: str, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Deletes the specified secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to delete.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the deleted secret.

### `delete_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L398](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L398)</sup>

```python theme={null}
delete_secret(secret_name: str, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Deletes the specified secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to delete.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the deleted secret.

### `adelete_secret_version` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L442](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L442)</sup>

```python theme={null}
adelete_secret_version(secret_name: str, version_id: int, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Deletes a version of a given secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `version_id`: Version number of the secret to use; "latest" can NOT be used.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the deleted secret version.

### `delete_secret_version` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L497](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L497)</sup>

```python theme={null}
delete_secret_version(secret_name: str, version_id: int, gcp_credentials: 'GcpCredentials', timeout: float = 60, project: Optional[str] = None) -> str
```

Deletes a version of a given secret from Google Cloud Platform's Secret Manager.

**Args:**

* `secret_name`: Name of the secret to retrieve.
* `version_id`: Version number of the secret to use; "latest" can NOT be used.
* `gcp_credentials`: Credentials to use for authentication with GCP.
* `timeout`: The number of seconds the transport should wait
  for the server response.
* `project`: Name of the project to use; overrides the
  gcp\_credentials project if provided.

**Returns:**

* The path of the deleted secret version.

## Classes

### `GcpSecret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L545](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L545)</sup>

Manages a secret in Google Cloud Platform's Secret Manager.

**Attributes:**

* `gcp_credentials`: Credentials to use for authentication with GCP.
* `secret_name`: Name of the secret to manage.
* `secret_version`: Version number of the secret to use, or "latest".

**Methods:**

#### `adelete_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L676](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L676)</sup>

```python theme={null}
adelete_secret(self) -> str
```

Deletes the secret from the secret storage service (async version).

**Returns:**

* The path that the secret was deleted from.

#### `aread_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L564](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L564)</sup>

```python theme={null}
aread_secret(self) -> bytes
```

Reads the secret data from the secret storage service (async version).

**Returns:**

* The secret data as bytes.

#### `awrite_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L600](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L600)</sup>

```python theme={null}
awrite_secret(self, secret_data: bytes) -> str
```

Writes the secret data to the secret storage service (async version);
if it doesn't exist it will be created.

**Args:**

* `secret_data`: The secret to write.

**Returns:**

* The path that the secret was written to.

#### `delete_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L695](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L695)</sup>

```python theme={null}
delete_secret(self) -> str
```

Deletes the secret from the secret storage service.

**Returns:**

* The path that the secret was deleted from.

#### `read_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L585](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L585)</sup>

```python theme={null}
read_secret(self) -> bytes
```

Reads the secret data from the secret storage service.

**Returns:**

* The secret data as bytes.

#### `write_secret` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect\_gcp/secret\_manager.py#L645](https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gcp/prefect_gcp/secret_manager.py#L645)</sup>

```python theme={null}
write_secret(self, secret_data: bytes) -> str
```

Writes the secret data to the secret storage service; if it doesn't exist
it will be created.

**Args:**

* `secret_data`: The secret to write.

**Returns:**

* The path that the secret was written to.
