Skip to content

Commit

Permalink
Merge pull request #11576 from linode/staging
Browse files Browse the repository at this point in the history
Release v1.135.0 - staging → master
  • Loading branch information
abailly-akamai authored Jan 28, 2025
2 parents 1ef9498 + b3bb140 commit 0b3126f
Show file tree
Hide file tree
Showing 255 changed files with 8,039 additions and 4,729 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e_schedule_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:
USER_4: ${{ secrets.USER_4 }}
CLIENT_ID: ${{ secrets.REACT_APP_CLIENT_ID }}
CY_TEST_FAIL_ON_MANAGED: 1
CY_TEST_RESET_PREFERENCES: 1
on:
schedule:
- cron: "0 13 * * 1-5"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ x-e2e-env:
CY_TEST_FEATURE_FLAGS: ${CY_TEST_FEATURE_FLAGS}
CY_TEST_TAGS: ${CY_TEST_TAGS}
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
CY_TEST_RESET_PREFERENCES: ${CY_TEST_RESET_PREFERENCES}

# Cypress environment variables for alternative parallelization.
CY_TEST_SPLIT_RUN: ${CY_TEST_SPLIT_RUN}
Expand Down
9 changes: 4 additions & 5 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Environment variables related to Cypress logging and reporting, as well as repor
| `CY_TEST_DISABLE_RETRIES` | Disable test retries on failure in CI | `1` | Unset; disabled by default |
| `CY_TEST_FAIL_ON_MANAGED` | Fail affected tests when Managed is enabled | `1` | Unset; disabled by default |
| `CY_TEST_GENWEIGHTS` | Generate and output test weights to the given path | `./weights.json` | Unset; disabled by default |
| `CY_TEST_RESET_PREFERENCES` | Reset user preferences when test run begins | `1` | Unset; disabled by default |
###### Performance
Expand Down Expand Up @@ -281,17 +282,15 @@ Environment variables that can be used to improve test performance in some scena
cy.wait('@getProfilePreferences');
cy.wait('@getAccountSettings');

/* `getVisible` defined in /cypress/support/helpers.ts
plus a few other commonly used commands shortened as methods */
getVisible(`tr[data-qa-linode="${label}"]`).within(() => {
cy.get(`tr[data-qa-linode="${label}"]`).should('be.visible').within(() => {
// use `within` to search inside/use data from/assert on a specific page element
cy.get(`[data-qa-ip-main]`)
// `realHover` and more real event methods from cypress real events plugin
.realHover()
.then(() => {
getVisible(`[aria-label="Copy ${ip} to clipboard"]`);
cy.get(`[aria-label="Copy ${ip} to clipboard"]`).should('be.visible');
});
getVisible(`[aria-label="Action menu for Linode ${label}"]`);
cy.get(`[aria-label="Action menu for Linode ${label}"]`).should('be.visible');
});
// `findByText` and others from cypress testing library plugin
cy.findByText('Oh Snap!', { timeout: 1000 }).should('not.exist');
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "Apache-2.0",
"devDependencies": {
"husky": "^9.1.6",
"typescript": "^5.5.4",
"typescript": "^5.7.3",
"vitest": "^2.1.1"
},
"scripts": {
Expand Down Expand Up @@ -52,7 +52,8 @@
"node-fetch": "^2.6.7",
"yaml": "^2.3.0",
"semver": "^7.5.2",
"cookie": "^0.7.0"
"cookie": "^0.7.0",
"nanoid": "^3.3.8"
},
"workspaces": {
"packages": [
Expand Down
17 changes: 17 additions & 0 deletions packages/api-v4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## [2025-01-28] - v0.133.0

### Changed:

- Allow `cipher_suite` to be `none` in `NodeBalancerConfig` and `CreateNodeBalancerConfig` ([#11515](https://github.com/linode/manager/pull/11515))

### Tech Stories:

- Update `tsconfig.json` to use `bundler` moduleResolution ([#11487](https://github.com/linode/manager/pull/11487))

### Upcoming Features:

- Update types for IAM and resources API ([#11429](https://github.com/linode/manager/pull/11429))
- Add types for Quotas endpoints ([#11493](https://github.com/linode/manager/pull/11493))
- Add Notification Channel related types to cloudpulse/alerts.ts ([#11511](https://github.com/linode/manager/pull/11511))


## [2025-01-14] - v0.132.0

### Added:
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linode/api-v4",
"version": "0.132.0",
"version": "0.133.0",
"homepage": "https://github.com/linode/manager/tree/develop/packages/api-v4",
"bugs": {
"url": "https://github.com/linode/manager/issues"
Expand Down
82 changes: 79 additions & 3 deletions packages/api-v4/src/cloudpulse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ export type MetricUnitType =
| 'KB'
| 'MB'
| 'GB';
export type NotificationStatus = 'Enabled' | 'Disabled';
export type ChannelType = 'email' | 'slack' | 'pagerduty' | 'webhook';
export type AlertNotificationType = 'default' | 'custom';
type AlertNotificationEmail = 'email';
type AlertNotificationSlack = 'slack';
type AlertNotificationPagerDuty = 'pagerduty';
type AlertNotificationWebHook = 'webhook';
export interface Dashboard {
id: number;
label: string;
Expand Down Expand Up @@ -55,7 +62,7 @@ export interface Widgets {
filters: Filters[];
serviceType: string;
service_type: string;
resource_id: string[];
entity_ids: string[];
time_granularity: TimeGranularity;
time_duration: TimeDuration;
unit: string;
Expand Down Expand Up @@ -106,7 +113,7 @@ export interface Dimension {
}

export interface JWETokenPayLoad {
resource_ids: number[];
entity_ids: number[];
}

export interface JWEToken {
Expand All @@ -120,7 +127,7 @@ export interface CloudPulseMetricsRequest {
group_by: string;
relative_time_duration: TimeDuration;
time_granularity: TimeGranularity | undefined;
resource_ids: number[];
entity_ids: number[];
}

export interface CloudPulseMetricsResponse {
Expand Down Expand Up @@ -218,3 +225,72 @@ export interface Alert {
created: string;
updated: string;
}

interface NotificationChannelAlerts {
id: number;
label: string;
url: string;
type: 'alerts-definitions';
}
interface NotificationChannelBase {
id: number;
label: string;
channel_type: ChannelType;
type: AlertNotificationType;
status: NotificationStatus;
alerts: NotificationChannelAlerts[];
created_by: string;
updated_by: string;
created_at: string;
updated_at: string;
}

interface NotificationChannelEmail extends NotificationChannelBase {
channel_type: AlertNotificationEmail;
content: {
email: {
email_addresses: string[];
subject: string;
message: string;
};
};
}

interface NotificationChannelSlack extends NotificationChannelBase {
channel_type: AlertNotificationSlack;
content: {
slack: {
slack_webhook_url: string;
slack_channel: string;
message: string;
};
};
}

interface NotificationChannelPagerDuty extends NotificationChannelBase {
channel_type: AlertNotificationPagerDuty;
content: {
pagerduty: {
service_api_key: string;
attributes: string[];
description: string;
};
};
}
interface NotificationChannelWebHook extends NotificationChannelBase {
channel_type: AlertNotificationWebHook;
content: {
webhook: {
webhook_url: string;
http_headers: {
header_key: string;
header_value: string;
}[];
};
};
}
export type NotificationChannel =
| NotificationChannelEmail
| NotificationChannelSlack
| NotificationChannelWebHook
| NotificationChannelPagerDuty;
2 changes: 2 additions & 0 deletions packages/api-v4/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export * from './placement-groups';

export * from './profile';

export * from './quotas';

export * from './regions';

export * from './stackscripts';
Expand Down
7 changes: 5 additions & 2 deletions packages/api-v4/src/nodebalancers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export interface NodeBalancerConfig {
stickiness: Stickiness;
algorithm: Algorithm;
ssl_fingerprint: string;
cipher_suite: 'recommended' | 'legacy';
/**
* Is `none` when protocol is UDP
*/
cipher_suite: 'recommended' | 'legacy' | 'none';
nodes: NodeBalancerConfigNode[];
}

Expand Down Expand Up @@ -160,7 +163,7 @@ export interface CreateNodeBalancerConfig {
* @default 80
*/
udp_check_port?: number;
cipher_suite?: 'recommended' | 'legacy';
cipher_suite?: 'recommended' | 'legacy' | 'none';
ssl_cert?: string;
ssl_key?: string;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/api-v4/src/quotas/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './types';

export * from './quotas';
36 changes: 36 additions & 0 deletions packages/api-v4/src/quotas/quotas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Filter, Params, ResourcePage as Page } from 'src/types';
import { API_ROOT } from '../constants';
import Request, { setMethod, setParams, setURL, setXFilter } from '../request';
import { Quota, QuotaType } from './types';

/**
* getQuota
*
* Returns the details for a single quota within a particular service specified by `type`.
*
* @param type { QuotaType } retrieve a quota within this service type.
* @param id { number } the quota ID to look up.
*/
export const getQuota = (type: QuotaType, id: number) =>
Request<Quota>(setURL(`${API_ROOT}/${type}/quotas/${id}`), setMethod('GET'));

/**
* getQuotas
*
* Returns a paginated list of quotas for a particular service specified by `type`.
*
* This request can be filtered on `quota_name`, `service_name` and `scope`.
*
* @param type { QuotaType } retrieve quotas within this service type.
*/
export const getQuotas = (
type: QuotaType,
params: Params = {},
filter: Filter = {}
) =>
Request<Page<Quota>>(
setURL(`${API_ROOT}/${type}/quotas`),
setMethod('GET'),
setXFilter(filter),
setParams(params)
);
70 changes: 70 additions & 0 deletions packages/api-v4/src/quotas/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { ObjectStorageEndpointTypes } from 'src/object-storage';
import { Region } from 'src/regions';

/**
* A Quota is a service used limit that is rated based on service metrics such
* as vCPUs used, instances or storage size.
*/
export interface Quota {
/**
* A unique identifier for the quota.
*/
quota_id: number;

/**
* Customer facing label describing the quota.
*/
quota_name: string;

/**
* Longer explanatory description for the quota.
*/
description: string;

/**
* The account-wide limit for this service, measured in units
* specified by the `resource_metric` field.
*/
quota_limit: number;

/**
* Current account usage, measured in units specified by the
* `resource_metric` field.
*/
used: number;

/**
* The unit of measurement for this service limit.
*/
resource_metric:
| 'instance'
| 'CPU'
| 'GPU'
| 'VPU'
| 'cluster'
| 'node'
| 'bucket'
| 'object'
| 'byte';

/**
* The region slug to which this limit applies.
*/
region_applied: Region['id'] | 'global';

/**
* The OBJ endpoint type to which this limit applies.
*
* For OBJ limits only.
*/
endpoint_type?: ObjectStorageEndpointTypes;

/**
* The S3 endpoint URL to which this limit applies.
*
* For OBJ limits only.
*/
s3_endpoint?: string;
}

export type QuotaType = 'linode' | 'lke' | 'object-storage';
1 change: 1 addition & 0 deletions packages/api-v4/src/request.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, describe, vi, expect, it } from 'vitest';
import adapter from 'axios-mock-adapter';
import { object, string } from 'yup';
import request, {
Expand Down
6 changes: 3 additions & 3 deletions packages/api-v4/src/resources/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type ResourceType =
export type ResourceType =
| 'linode'
| 'firewall'
| 'nodebalancer'
Expand All @@ -10,10 +10,10 @@ type ResourceType =
| 'database'
| 'vpc';

export type IamAccountResource = {
export interface IamAccountResource {
resource_type: ResourceType;
resources: Resource[];
}[];
}

export interface Resource {
name: string;
Expand Down
9 changes: 2 additions & 7 deletions packages/api-v4/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"types": ["vitest/globals"],
"module": "umd",
"module": "esnext",
"emitDeclarationOnly": true,
"declaration": true,
"outDir": "./lib",
"esModuleInterop": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"skipLibCheck": true,
"strict": true,
"baseUrl": ".",
Expand All @@ -17,9 +16,5 @@
},
"include": [
"src"
],
"exclude": [
"node_modules/**/*",
"**/__tests__/*"
]
}
Loading

0 comments on commit 0b3126f

Please sign in to comment.