Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [M3-8005] – Add disk_encryption to types & validation schemas #10413

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Changed
---

Add disk_encryption to Linode, Disk, CreateLinodeRequest, RebuildRequest, and KubeNodePoolResponse interfaces ([#10413](https://github.com/linode/manager/pull/10413))
3 changes: 3 additions & 0 deletions packages/api-v4/src/kubernetes/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { EncryptionStatus } from 'src/linodes';

export interface KubernetesCluster {
created: string;
updated: string;
Expand All @@ -16,6 +18,7 @@ export interface KubeNodePoolResponse {
nodes: PoolNodeResponse[];
type: string;
autoscaler: AutoscaleSettings;
disk_encryption?: EncryptionStatus; // @TODO LDE: remove optionality once LDE is fully rolled out
}

export interface PoolNodeResponse {
Expand Down
12 changes: 11 additions & 1 deletion packages/api-v4/src/linodes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { PlacementGroupPayload } from '../placement-groups/types';

export type Hypervisor = 'kvm' | 'zen';

export type EncryptionStatus = 'enabled' | 'disabled';

export interface LinodeSpecs {
disk: number;
memory: number;
Expand All @@ -18,6 +20,7 @@ export interface Linode {
alerts: LinodeAlerts;
backups: LinodeBackups;
created: string;
disk_encryption?: EncryptionStatus; // @TODO LDE: Remove optionality once LDE is fully rolled out
region: string;
image: string | null;
group: string;
Expand Down Expand Up @@ -267,6 +270,7 @@ export interface Disk {
filesystem: Filesystem;
created: string;
updated: string;
disk_encryption?: EncryptionStatus; // @TODO LDE: remove optionality once LDE is fully rolled out
}

export type DiskStatus = 'ready' | 'not ready' | 'deleting';
Expand Down Expand Up @@ -446,9 +450,14 @@ export interface CreateLinodeRequest {
*/
firewall_id?: number | null;
/**
* An object that assigns this the Linode to a placment group upon creation.
* An object that assigns this the Linode to a placement group upon creation.
*/
placement_group?: CreateLinodePlacementGroupPayload;
/**
* A property with a string literal type indicating whether the Linode is encrypted or unencrypted.
* @default 'enabled' (if the region supports LDE)
*/
disk_encryption?: EncryptionStatus;
}

export interface MigrateLinodeRequest {
Expand Down Expand Up @@ -484,6 +493,7 @@ export interface RebuildRequest {
stackscript_id?: number;
stackscript_data?: any;
booted?: boolean;
disk_encryption?: EncryptionStatus;
}

export interface LinodeDiskCreationData {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/validation": Changed
---

Include disk_encryption in CreateLinodeSchema and RebuildLinodeSchema ([#10413](https://github.com/linode/manager/pull/10413))
9 changes: 9 additions & 0 deletions packages/validation/src/linodes.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ const PlacementGroupPayloadSchema = object({
id: number().notRequired().nullable(true),
});

const DiskEncryptionSchema = object({
disk_encryption: string()
.oneOf(['enabled', 'disabled'])
.nullable()
.notRequired(),
});

export const CreateLinodeSchema = object({
type: string().ensure().required('Plan is required.'),
region: string().ensure().required('Region is required.'),
Expand Down Expand Up @@ -309,6 +316,7 @@ export const CreateLinodeSchema = object({
metadata: MetadataSchema,
firewall_id: number().nullable().notRequired(),
placement_group: PlacementGroupPayloadSchema,
disk_encryption: DiskEncryptionSchema,
});

const alerts = object({
Expand Down Expand Up @@ -389,6 +397,7 @@ export const RebuildLinodeSchema = object().shape({
stackscript_data,
booted: boolean().notRequired(),
metadata: MetadataSchema,
disk_encryption: DiskEncryptionSchema,
});

export const RebuildLinodeFromStackScriptSchema = RebuildLinodeSchema.shape({
Expand Down
Loading