# SecretPathVolumeOptions

Options for a Kubernetes SecretPath Volume.

Extends: [EksVolumeOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EksVolumeOptions.html)
Used as props by: [SecretPathVolume](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.SecretPathVolume.html)
Used as argument in: [EksVolume.secret](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EksVolume.html#secret)

- Source: [`aws-batch/lib/eks-container-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-batch/lib/eks-container-definition.ts#L869)
- Type last changed: v2.96.0 · 13 Sep 2023

## Example

TypeScript:

```ts
declare const jobDefn: batch.EksJobDefinition;
jobDefn.container.addVolume(batch.EksVolume.emptyDir({
  name: 'emptyDir',
  mountPath: '/Volumes/emptyDir',
}));
jobDefn.container.addVolume(batch.EksVolume.hostPath({
  name: 'hostPath',
  hostPath: '/sys',
  mountPath: '/Volumes/hostPath',
}));
jobDefn.container.addVolume(batch.EksVolume.secret({
  name: 'secret',
  optional: true,
  mountPath: '/Volumes/secret',
  secretName: 'mySecret',
}));
```

Python:

```python
# job_defn: batch.EksJobDefinition

job_defn.container.add_volume(batch.EksVolume.empty_dir(
    name="emptyDir",
    mount_path="/Volumes/emptyDir"
))
job_defn.container.add_volume(batch.EksVolume.host_path(
    name="hostPath",
    host_path="/sys",
    mount_path="/Volumes/hostPath"
))
job_defn.container.add_volume(batch.EksVolume.secret(
    name="secret",
    optional=True,
    mount_path="/Volumes/secret",
    secret_name="mySecret"
))
```

Java:

```java
EksJobDefinition jobDefn;

jobDefn.container.addVolume(EksVolume.emptyDir(EmptyDirVolumeOptions.builder()
        .name("emptyDir")
        .mountPath("/Volumes/emptyDir")
        .build()));
jobDefn.container.addVolume(EksVolume.hostPath(HostPathVolumeOptions.builder()
        .name("hostPath")
        .hostPath("/sys")
        .mountPath("/Volumes/hostPath")
        .build()));
jobDefn.container.addVolume(EksVolume.secret(SecretPathVolumeOptions.builder()
        .name("secret")
        .optional(true)
        .mountPath("/Volumes/secret")
        .secretName("mySecret")
        .build()));
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
EksJobDefinition jobDefn;

jobDefn.Container.AddVolume(EksVolume.EmptyDir(new EmptyDirVolumeOptions {
    Name = "emptyDir",
    MountPath = "/Volumes/emptyDir"
}));
jobDefn.Container.AddVolume(EksVolume.HostPath(new HostPathVolumeOptions {
    Name = "hostPath",
    HostPath = "/sys",
    MountPath = "/Volumes/hostPath"
}));
jobDefn.Container.AddVolume(EksVolume.Secret(new SecretPathVolumeOptions {
    Name = "secret",
    Optional = true,
    MountPath = "/Volumes/secret",
    SecretName = "mySecret"
}));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var jobDefn EksJobDefinition

jobDefn.Container.AddVolume(batch.EksVolume_EmptyDir(&EmptyDirVolumeOptions{
	Name: jsii.String("emptyDir"),
	MountPath: jsii.String("/Volumes/emptyDir"),
}))
jobDefn.Container.AddVolume(batch.EksVolume_HostPath(&HostPathVolumeOptions{
	Name: jsii.String("hostPath"),
	HostPath: jsii.String("/sys"),
	MountPath: jsii.String("/Volumes/hostPath"),
}))
jobDefn.Container.AddVolume(batch.EksVolume_Secret(&SecretPathVolumeOptions{
	Name: jsii.String("secret"),
	Optional: jsii.Boolean(true),
	MountPath: jsii.String("/Volumes/secret"),
	SecretName: jsii.String("mySecret"),
}))
```

## Properties

- `mountPath`: string — The path on the container where the volume is mounted.

  **Default:** the volume is not mounted

- `name`: string (required) — The name of this volume.

  The name must be a valid DNS subdomain name.

- `optional`: boolean = true — Specifies whether the secret or the secret's keys must be defined.

- `readonly`: boolean = false — If specified, the container has readonly access to the volume.

  Otherwise, the container has read/write access.

- `secretName`: string (required) — The name of the secret.

  Must be a valid DNS subdomain name.
