Skip to content

Commit

Permalink
Merge branch 'linode:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
cpathipa authored Jul 24, 2024
2 parents 3fb49a6 + 39618f8 commit 6c76508
Show file tree
Hide file tree
Showing 119 changed files with 2,067 additions and 482 deletions.

This file was deleted.

5 changes: 0 additions & 5 deletions packages/api-v4/.changeset/pr-10651-changed-1720544132377.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/api-v4/.changeset/pr-10651-changed-1720544224086.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/api-v4/.changeset/pr-10656-changed-1720474042051.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Upcoming Features
---

Added MetricDefinitions, Dimension, JWETokenPayload, JWEToken and metricDefinitions, dashboard by id and jwe token api calls ([#10676](https://github.com/linode/manager/pull/10676))
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-10686-changed-1721191675845.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Changed
---

Updated Object Storage types with more descriptive names. ([#10686](https://github.com/linode/manager/pull/10686))
12 changes: 12 additions & 0 deletions packages/api-v4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [2024-07-22] - v0.122.0

### Changed:

- Breaking: change Placement Group `affinity_type` to `placement_group_type` ([#10651](https://github.com/linode/manager/pull/10651))
- Breaking: change Placement Group `is_strict` to `placement_group_policy` ([#10651](https://github.com/linode/manager/pull/10651))
- Use new "lish" API instead of "lish_token" ([#10656](https://github.com/linode/manager/pull/10656))

### Upcoming Features:

- Add ACLG Config and Widget to CloudPulse types ([#10625](https://github.com/linode/manager/pull/10625))

## [2024-07-08] - v0.121.0

### Changed:
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.121.0",
"version": "0.122.0",
"homepage": "https://github.com/linode/manager/tree/develop/packages/api-v4",
"bugs": {
"url": "https://github.com/linode/manager/issues"
Expand Down
8 changes: 7 additions & 1 deletion packages/api-v4/src/cloudpulse/dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import Request, { setMethod, setURL } from '../request';
import { Dashboard } from './types';
import { API_ROOT } from 'src/constants';

//Returns the list of all the dashboards available
// Returns the list of all the dashboards available
export const getDashboards = () =>
Request<ResourcePage<Dashboard>>(
setURL(`${API_ROOT}/monitor/services/linode/dashboards`),
setMethod('GET')
);

export const getDashboardById = (dashboardId: number) =>
Request<Dashboard>(
setURL(`${API_ROOT}/monitor/dashboards/${encodeURIComponent(dashboardId)}`),
setMethod('GET')
);
2 changes: 2 additions & 0 deletions packages/api-v4/src/cloudpulse/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './types';

export * from './dashboards';

export * from './services';
24 changes: 24 additions & 0 deletions packages/api-v4/src/cloudpulse/services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { API_ROOT } from 'src/constants';
import Request, { setData, setMethod, setURL } from '../request';
import { JWEToken, JWETokenPayLoad, MetricDefinitions } from './types';
import { ResourcePage as Page } from 'src/types';

export const getMetricDefinitionsByServiceType = (serviceType: string) => {
return Request<Page<MetricDefinitions>>(
setURL(
`${API_ROOT}/monitor/services/${encodeURIComponent(
serviceType
)}/metric-definitions`
),
setMethod('GET')
);
};

export const getJWEToken = (data: JWETokenPayLoad, serviceType: string) =>
Request<JWEToken>(
setURL(
`${API_ROOT}/monitor/services/${encodeURIComponent(serviceType)}/token`
),
setMethod('POST'),
setData(data)
);
28 changes: 28 additions & 0 deletions packages/api-v4/src/cloudpulse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,31 @@ export interface AclpWidget {
label: string;
size: number;
}

export interface MetricDefinitions {
data: AvailableMetrics[];
}

export interface AvailableMetrics {
label: string;
metric: string;
metric_type: string;
unit: string;
scrape_interval: string;
available_aggregate_functions: string[];
dimensions: Dimension[];
}

export interface Dimension {
label: string;
dimension_label: string;
values: string[];
}

export interface JWETokenPayLoad {
resource_id: string[];
}

export interface JWEToken{
token: string;
}
44 changes: 22 additions & 22 deletions packages/api-v4/src/object-storage/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import Request, {
import { Filter, Params, ResourcePage as Page } from '../types';
import {
ObjectStorageBucket,
ObjectStorageBucketAccessRequest,
ObjectStorageBucketAccessResponse,
ObjectStorageBucketRequestPayload,
ObjectStorageBucketSSLRequest,
ObjectStorageBucketSSLResponse,
ObjectStorageDeleteBucketRequestPayload,
ObjectStorageObjectListParams,
ObjectStorageObjectListResponse,
UpdateObjectStorageBucketAccessPayload,
ObjectStorageBucketAccess,
CreateObjectStorageBucketPayload,
CreateObjectStorageBucketSSLPayload,
ObjectStorageBucketSSL,
DeleteObjectStorageBucketPayload,
GetObjectStorageObjectListPayload,
ObjectStorageObjectList,
} from './types';

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ export const getBucketsInRegion = (
* @param data { object } The label and clusterId of the new Bucket.
*
*/
export const createBucket = (data: ObjectStorageBucketRequestPayload) =>
export const createBucket = (data: CreateObjectStorageBucketPayload) =>
Request<ObjectStorageBucket>(
setURL(`${API_ROOT}/object-storage/buckets`),
setMethod('POST'),
Expand All @@ -113,7 +113,7 @@ export const createBucket = (data: ObjectStorageBucketRequestPayload) =>
export const deleteBucket = ({
cluster,
label,
}: ObjectStorageDeleteBucketRequestPayload) =>
}: DeleteObjectStorageBucketPayload) =>
Request<ObjectStorageBucket>(
setURL(
`${API_ROOT}/object-storage/buckets/${encodeURIComponent(
Expand Down Expand Up @@ -155,12 +155,12 @@ export const deleteBucketWithRegion = ({
/**
* Returns a list of Objects in a given Bucket.
*/
export const getObjectList = (
clusterId: string,
bucketName: string,
params?: ObjectStorageObjectListParams
) =>
Request<ObjectStorageObjectListResponse>(
export const getObjectList = ({
clusterId,
bucket: bucketName,
params,
}: GetObjectStorageObjectListPayload) =>
Request<ObjectStorageObjectList>(
setMethod('GET'),
setParams(params),
setURL(
Expand All @@ -176,9 +176,9 @@ export const getObjectList = (
export const uploadSSLCert = (
clusterId: string,
bucketName: string,
data: ObjectStorageBucketSSLRequest
data: CreateObjectStorageBucketSSLPayload
) =>
Request<ObjectStorageBucketSSLResponse>(
Request<ObjectStorageBucketSSL>(
setMethod('POST'),
setData(data, UploadCertificateSchema),
setURL(
Expand All @@ -195,7 +195,7 @@ export const uploadSSLCert = (
* the specified bucket, { ssl: false } otherwise.
*/
export const getSSLCert = (clusterId: string, bucketName: string) =>
Request<ObjectStorageBucketSSLResponse>(
Request<ObjectStorageBucketSSL>(
setMethod('GET'),
setURL(
`${API_ROOT}/object-storage/buckets/${encodeURIComponent(
Expand Down Expand Up @@ -227,7 +227,7 @@ export const deleteSSLCert = (clusterId: string, bucketName: string) =>
* Returns access information (ACL, CORS) for a given Bucket.
*/
export const getBucketAccess = (clusterId: string, bucketName: string) =>
Request<ObjectStorageBucketAccessResponse>(
Request<ObjectStorageBucketAccess>(
setMethod('GET'),
setURL(
`${API_ROOT}/object-storage/buckets/${encodeURIComponent(
Expand All @@ -244,7 +244,7 @@ export const getBucketAccess = (clusterId: string, bucketName: string) =>
export const updateBucketAccess = (
clusterId: string,
bucketName: string,
data: ObjectStorageBucketAccessRequest
params: UpdateObjectStorageBucketAccessPayload
) =>
Request<{}>(
setMethod('PUT'),
Expand All @@ -253,5 +253,5 @@ export const updateBucketAccess = (
clusterId
)}/${encodeURIComponent(bucketName)}/access`
),
setData(data, UpdateBucketAccessSchema)
setData(params, UpdateBucketAccessSchema)
);
8 changes: 4 additions & 4 deletions packages/api-v4/src/object-storage/objectStorageKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import Request, {
import { Filter, Params, ResourcePage as Page } from '../types';
import {
ObjectStorageKey,
ObjectStorageKeyRequest,
UpdateObjectStorageKeyRequest,
CreateObjectStorageKeyPayload,
UpdateObjectStorageKeyPayload,
} from './types';

/**
Expand All @@ -35,7 +35,7 @@ export const getObjectStorageKeys = (params?: Params, filters?: Filter) =>
*
* Creates an Object Storage key
*/
export const createObjectStorageKeys = (data: ObjectStorageKeyRequest) =>
export const createObjectStorageKeys = (data: CreateObjectStorageKeyPayload) =>
Request<ObjectStorageKey>(
setMethod('POST'),
setURL(`${API_ROOT}/object-storage/keys`),
Expand All @@ -49,7 +49,7 @@ export const createObjectStorageKeys = (data: ObjectStorageKeyRequest) =>
*/
export const updateObjectStorageKey = (
id: number,
data: UpdateObjectStorageKeyRequest
data: UpdateObjectStorageKeyPayload
) =>
Request<ObjectStorageKey>(
setMethod('PUT'),
Expand Down
27 changes: 15 additions & 12 deletions packages/api-v4/src/object-storage/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ import Request, {
} from '../request';
import {
ACLType,
ObjectStorageEndpointsResponse,
ObjectStorageEndpoint,
ObjectStorageObjectACL,
ObjectStorageObjectURL,
ObjectStorageObjectURLOptions,
GetObjectStorageACLPayload,
CreateObjectStorageObjectURLPayload,
} from './types';

import type { ResourcePage, RequestOptions } from '../types';

/**
* Gets a URL to upload/download/delete Objects from a Bucket.
* Creates a pre-signed URL to access a single object in a bucket.
* Use it to share, create, or delete objects by using the appropriate
* HTTP method in your request body's method parameter.
*/
export const getObjectURL = (
clusterId: string,
bucketName: string,
name: string,
method: 'GET' | 'PUT' | 'POST' | 'DELETE',
options?: ObjectStorageObjectURLOptions
options?: CreateObjectStorageObjectURLPayload
) =>
Request<ObjectStorageObjectURL>(
setMethod('POST'),
Expand All @@ -42,18 +45,18 @@ export const getObjectURL = (
*
* Gets the ACL for a given Object.
*/
export const getObjectACL = (
clusterId: string,
bucketName: string,
name: string
) =>
export const getObjectACL = ({
clusterId,
bucket,
params,
}: GetObjectStorageACLPayload) =>
Request<ObjectStorageObjectACL>(
setMethod('GET'),
setURL(
`${API_ROOT}/object-storage/buckets/${encodeURIComponent(
clusterId
)}/${encodeURIComponent(bucketName)}/object-acl?name=${encodeURIComponent(
name
)}/${encodeURIComponent(bucket)}/object-acl?name=${encodeURIComponent(
params.name
)}`
)
);
Expand Down Expand Up @@ -81,7 +84,7 @@ export const updateObjectACL = (
);

export const getObjectStorageEndpoints = ({ filter, params }: RequestOptions) =>
Request<ResourcePage<ObjectStorageEndpointsResponse[]>>(
Request<ResourcePage<ObjectStorageEndpoint>>(
setMethod('GET'),
setURL(`${API_ROOT}/object-storage/endpoints`),
setParams(params),
Expand Down
Loading

0 comments on commit 6c76508

Please sign in to comment.