Skip to content
Open
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
---

Adjust Custom HTTPS Destination types: content type, data compression, custom headers ([#13331](https://github.com/linode/manager/pull/13331))
20 changes: 16 additions & 4 deletions packages/api-v4/src/delivery/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,25 @@ export interface AkamaiObjectStorageDetailsExtended
access_key_secret: string;
}

type ContentType = 'application/json' | 'application/json; charset=utf-8';
type DataCompressionType = 'gzip' | 'None';
export const contentType = {
Json: 'application/json',
JsonUtf8: 'application/json; charset=utf-8',
} as const;

export type ContentType = (typeof contentType)[keyof typeof contentType] | null;

export const dataCompressionType = {
Gzip: 'gzip',
None: 'None',
} as const;

export type DataCompressionType =
(typeof dataCompressionType)[keyof typeof dataCompressionType];

export interface CustomHTTPSDetails {
authentication: Authentication;
client_certificate_details?: ClientCertificateDetails;
content_type: ContentType;
content_type?: ContentType;
custom_headers?: CustomHeader[];
data_compression: DataCompressionType;
endpoint_url: string;
Expand Down Expand Up @@ -109,7 +121,7 @@ interface AuthenticationDetails {
basic_authentication_user: string;
}

interface CustomHeader {
export interface CustomHeader {
name: string;
value: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add Additional Options section to the Custom HTTPS destination type ([#13331](https://github.com/linode/manager/pull/13331))
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { ui } from 'support/ui';

import { destinationFactory } from 'src/factories';
import { akamaiObjectStorageDestinationFactory } from 'src/factories';

import type { Destination } from '@linode/api-v4';

Expand Down Expand Up @@ -95,7 +95,7 @@ function editDestinationViaActionMenu(
const mockDestinations: Destination[] = new Array(3)
.fill(null)
.map((_item: null, index: number): Destination => {
return destinationFactory.build({
return akamaiObjectStorageDestinationFactory.build({
label: `Destination ${index}`,
});
});
Expand Down
16 changes: 10 additions & 6 deletions packages/manager/cypress/support/constants/delivery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { destinationType, streamType } from '@linode/api-v4';
import { randomLabel, randomString } from 'support/util/random';

import { destinationFactory, streamFactory } from 'src/factories';
import {
akamaiObjectStorageDestinationFactory,
streamFactory,
} from 'src/factories';

import type {
CreateDestinationPayload,
Expand All @@ -22,11 +25,12 @@ export const mockDestinationPayload: CreateDestinationPayload = {
},
};

export const mockDestination: Destination = destinationFactory.build({
id: 1290,
...mockDestinationPayload,
version: '1.0',
});
export const mockDestination: Destination =
akamaiObjectStorageDestinationFactory.build({
id: 1290,
...mockDestinationPayload,
version: '1.0',
});

export const mockDestinationPayloadWithId = {
id: mockDestination.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const logsDestinationForm = {
cy.findByLabelText('Bucket')
.should('be.visible')
.should('be.enabled')
.should('have.attr', 'placeholder', 'Bucket')
.clear();
cy.focused().type(bucketName);
},
Expand All @@ -57,7 +56,6 @@ export const logsDestinationForm = {
cy.findByLabelText('Access Key ID')
.should('be.visible')
.should('be.enabled')
.should('have.attr', 'placeholder', 'Access Key ID')
.clear();
cy.focused().type(accessKeyId);
},
Expand All @@ -71,7 +69,6 @@ export const logsDestinationForm = {
cy.findByLabelText('Secret Access Key')
.should('be.visible')
.should('be.enabled')
.should('have.attr', 'placeholder', 'Secret Access Key')
.clear();
cy.focused().type(secretAccessKey);
},
Expand Down
59 changes: 42 additions & 17 deletions packages/manager/src/factories/delivery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,52 @@

import type { Destination } from '@linode/api-v4';

export const destinationFactory = Factory.Sync.makeFactory<Destination>({
details: {
access_key_id: 'Access Id',
bucket_name: 'destinations-bucket-name',
host: 'destinations-bucket-name.host.com',
path: 'file',
},
id: Factory.each((id) => id),
label: Factory.each((id) => `Destination ${id}`),
type: destinationType.AkamaiObjectStorage,
version: '1.0',
updated: '2025-07-30',
updated_by: 'username',
created: '2025-07-30',
created_by: 'username',
});
let destinationIdCounter = 0;
const nextDestinationId = () => ++destinationIdCounter;

Check warning on line 7 in packages/manager/src/factories/delivery.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Extract this increment operation into a dedicated statement. Raw Output: {"ruleId":"sonarjs/no-nested-incdec","severity":1,"message":"Extract this increment operation into a dedicated statement.","line":7,"column":33,"nodeType":"UpdateExpression","messageId":"extractOperation","endLine":7,"endColumn":55}

export const akamaiObjectStorageDestinationFactory =
Factory.Sync.makeFactory<Destination>({
details: {
access_key_id: 'Access Id',
bucket_name: 'destinations-bucket-name',
host: 'destinations-bucket-name.host.com',
path: 'file',
},
id: Factory.each(() => nextDestinationId()),
label: Factory.each((id) => `Akamai Object Storage Destination ${id}`),
type: destinationType.AkamaiObjectStorage,
version: '1.0',
updated: '2025-07-30',

Check warning on line 21 in packages/manager/src/factories/delivery.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Define a constant instead of duplicating this literal 6 times. Raw Output: {"ruleId":"sonarjs/no-duplicate-string","severity":1,"message":"Define a constant instead of duplicating this literal 6 times.","line":21,"column":14,"nodeType":"Literal","endLine":21,"endColumn":26}
updated_by: 'username',
created: '2025-07-30',
created_by: 'username',
});

export const customHttpsDestinationFactory =
Factory.Sync.makeFactory<Destination>({
details: {
authentication: {
type: 'none',
},
data_compression: 'None',
endpoint_url: 'https://example.com/endpoint',
content_type: 'application/json',
custom_headers: [{ name: 'X-Test', value: '1' }],
},
id: Factory.each(() => nextDestinationId()),
label: Factory.each((id) => `Custom HTTPS Destination ${id}`),
type: destinationType.CustomHttps,
version: '1.0',
updated: '2025-07-30',
updated_by: 'username',
created: '2025-07-30',
created_by: 'username',
});

export const streamFactory = Factory.Sync.makeFactory<Stream>({
created_by: 'username',
destinations: Factory.each(() => [
{ ...destinationFactory.build(), id: 123 },
{ ...akamaiObjectStorageDestinationFactory.build(), id: 123 },
]),
details: null,
updated: '2025-07-30',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import * as React from 'react';

import { destinationFactory } from 'src/factories';
import { akamaiObjectStorageDestinationFactory } from 'src/factories';
import { DestinationActionMenu } from 'src/features/Delivery/Destinations/DestinationActionMenu';
import { renderWithTheme } from 'src/utilities/testHelpers';

Expand All @@ -12,7 +12,7 @@ describe('DestinationActionMenu', () => {
it('should include proper Stream actions', async () => {
renderWithTheme(
<DestinationActionMenu
destination={destinationFactory.build()}
destination={akamaiObjectStorageDestinationFactory.build()}
onDelete={fakeHandler}
onEdit={fakeHandler}
/>
Expand Down
Loading
Loading