# API Reference
## Constructs
### ValheimWorld
#### Initializers
```typescript
import { ValheimWorld } from 'cdk-valheim'
new ValheimWorld(scope: Construct, id: string, props?: ValheimWorldProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| scope | constructs.Construct | *No description.* |
| id | string | *No description.* |
| props | ValheimWorldProps | *No description.* |
---
##### `scope`Required
- *Type:* constructs.Construct
---
##### `id`Required
- *Type:* string
---
##### `props`Optional
- *Type:* ValheimWorldProps
---
#### Methods
| **Name** | **Description** |
| --- | --- |
| toString | Returns a string representation of this construct. |
---
##### `toString`
```typescript
public toString(): string
```
Returns a string representation of this construct.
#### Properties
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| backupPlan | aws-cdk-lib.aws_backup.BackupPlan | *No description.* |
| fileSystem | aws-cdk-lib.aws_efs.FileSystem | *No description.* |
| service | aws-cdk-lib.aws_ecs.FargateService | *No description.* |
| schedules | ValheimWorldScalingSchedule[] | *No description.* |
---
##### `backupPlan`Required
```typescript
public readonly backupPlan: BackupPlan;
```
- *Type:* aws-cdk-lib.aws_backup.BackupPlan
---
##### `fileSystem`Required
```typescript
public readonly fileSystem: FileSystem;
```
- *Type:* aws-cdk-lib.aws_efs.FileSystem
---
##### `service`Required
```typescript
public readonly service: FargateService;
```
- *Type:* aws-cdk-lib.aws_ecs.FargateService
---
##### `schedules`Optional
```typescript
public readonly schedules: ValheimWorldScalingSchedule[];
```
- *Type:* ValheimWorldScalingSchedule[]
---
## Structs
### ValheimWorldProps
#### Initializer
```typescript
import { ValheimWorldProps } from 'cdk-valheim'
const valheimWorldProps: ValheimWorldProps = { ... }
```
#### Properties
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| backupPlan | aws-cdk-lib.aws_backup.BackupPlan | AWS Backup plan for EFS. |
| containerPath | string | The path on the container to mount the host volume at. |
| cpu | number | The number of cpu units used by the task. |
| desiredCount | number | Desired count of Fargate container. |
| environment | {[ key: string ]: string} | The environment variables to pass to the container. |
| fileSystem | aws-cdk-lib.aws_efs.FileSystem | Persistent storage for save data. |
| image | aws-cdk-lib.aws_ecs.ContainerImage | The image used to start a container. |
| logGroup | aws-cdk-lib.aws_ecs.LogDriver | Valheim Server log Group. |
| memoryLimitMiB | number | The amount (in MiB) of memory used by the task. |
| schedules | ValheimWorldScalingScheduleProps[] | Running schedules. |
| vpc | aws-cdk-lib.aws_ec2.IVpc | The VPC where your ECS instances will be running or your ENIs will be deployed. |
---
##### `backupPlan`Optional
```typescript
public readonly backupPlan: BackupPlan;
```
- *Type:* aws-cdk-lib.aws_backup.BackupPlan
- *Default:* Hourly backup with 3 days retension.
AWS Backup plan for EFS.
---
##### `containerPath`Optional
```typescript
public readonly containerPath: string;
```
- *Type:* string
- *Default:* /config/
The path on the container to mount the host volume at.
---
##### `cpu`Optional
```typescript
public readonly cpu: number;
```
- *Type:* number
- *Default:* 1024
The number of cpu units used by the task.
For tasks using the Fargate launch type,
this field is required and you must use one of the following values,
which determines your range of valid values for the memory parameter:
256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
---
##### `desiredCount`Optional
```typescript
public readonly desiredCount: number;
```
- *Type:* number
- *Default:* 1
Desired count of Fargate container.
Set 0 for maintenance.
---
##### `environment`Optional
```typescript
public readonly environment: {[ key: string ]: string};
```
- *Type:* {[ key: string ]: string}
- *Default:* No environment variables.
The environment variables to pass to the container.
---
##### `fileSystem`Optional
```typescript
public readonly fileSystem: FileSystem;
```
- *Type:* aws-cdk-lib.aws_efs.FileSystem
- *Default:* Amazon EFS for default persistent storage.
Persistent storage for save data.
---
##### `image`Optional
```typescript
public readonly image: ContainerImage;
```
- *Type:* aws-cdk-lib.aws_ecs.ContainerImage
- *Default:* [lloesche/valheim-server](https://hub.docker.com/r/lloesche/valheim-server)
The image used to start a container.
This string is passed directly to the Docker daemon.
Images in the Docker Hub registry are available by default.
Other repositories are specified with either repository-url/image:tag or repository-url/image@digest.
---
##### `logGroup`Optional
```typescript
public readonly logGroup: LogDriver;
```
- *Type:* aws-cdk-lib.aws_ecs.LogDriver
- *Default:* Create the new AWS Cloudwatch Log Group for Valheim Server.
Valheim Server log Group.
---
##### `memoryLimitMiB`Optional
```typescript
public readonly memoryLimitMiB: number;
```
- *Type:* number
- *Default:* 2048
The amount (in MiB) of memory used by the task.
For tasks using the Fargate launch type,
this field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter:
512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
---
##### `schedules`Optional
```typescript
public readonly schedules: ValheimWorldScalingScheduleProps[];
```
- *Type:* ValheimWorldScalingScheduleProps[]
- *Default:* Always running.
Running schedules.
---
##### `vpc`Optional
```typescript
public readonly vpc: IVpc;
```
- *Type:* aws-cdk-lib.aws_ec2.IVpc
- *Default:* creates a new VPC with two AZs
The VPC where your ECS instances will be running or your ENIs will be deployed.
---
### ValheimWorldScalingScheduleProps
Options for ValheimWorldScalingSchedule.
#### Initializer
```typescript
import { ValheimWorldScalingScheduleProps } from 'cdk-valheim'
const valheimWorldScalingScheduleProps: ValheimWorldScalingScheduleProps = { ... }
```
#### Properties
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| start | aws-cdk-lib.aws_applicationautoscaling.CronOptions | Options to configure a cron expression for server for server launching schedule. |
| stop | aws-cdk-lib.aws_applicationautoscaling.CronOptions | Options to configure a cron expression for server zero-scale schedule. |
---
##### `start`Required
```typescript
public readonly start: CronOptions;
```
- *Type:* aws-cdk-lib.aws_applicationautoscaling.CronOptions
Options to configure a cron expression for server for server launching schedule.
All fields are strings so you can use complex expressions. Absence of
a field implies '*' or '?', whichever one is appropriate. Only comma
separated numbers and hypens are allowed.
---
##### `stop`Required
```typescript
public readonly stop: CronOptions;
```
- *Type:* aws-cdk-lib.aws_applicationautoscaling.CronOptions
Options to configure a cron expression for server zero-scale schedule.
All fields are strings so you can use complex expressions. Absence of
a field implies '*' or '?', whichever one is appropriate. Only comma
separated numbers and hypens are allowed.
---
## Classes
### ValheimWorldScalingSchedule
Represents the schedule to determine when the server starts or terminates.
#### Initializers
```typescript
import { ValheimWorldScalingSchedule } from 'cdk-valheim'
new ValheimWorldScalingSchedule(schedule: ValheimWorldScalingScheduleProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| schedule | ValheimWorldScalingScheduleProps | *No description.* |
---
##### `schedule`Required
- *Type:* ValheimWorldScalingScheduleProps
---
#### Methods
| **Name** | **Description** |
| --- | --- |
| toCronOptions | Returns the cron options merged properties for both start and stop. |
---
##### `toCronOptions`
```typescript
public toCronOptions(): CronOptions
```
Returns the cron options merged properties for both start and stop.
#### Properties
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| start | aws-cdk-lib.aws_applicationautoscaling.CronOptions | Options to configure a cron expression for server for server launching schedule. |
| stop | aws-cdk-lib.aws_applicationautoscaling.CronOptions | Options to configure a cron expression for server zero-scale schedule. |
---
##### `start`Required
```typescript
public readonly start: CronOptions;
```
- *Type:* aws-cdk-lib.aws_applicationautoscaling.CronOptions
Options to configure a cron expression for server for server launching schedule.
All fields are strings so you can use complex expressions. Absence of
a field implies '*' or '?', whichever one is appropriate. Only comma
separated numbers and hypens are allowed.
---
##### `stop`Required
```typescript
public readonly stop: CronOptions;
```
- *Type:* aws-cdk-lib.aws_applicationautoscaling.CronOptions
Options to configure a cron expression for server zero-scale schedule.
All fields are strings so you can use complex expressions. Absence of
a field implies '*' or '?', whichever one is appropriate. Only comma
separated numbers and hypens are allowed.
---