Skip to content

Commit 6f0dfc9

Browse files
authored
Merge branch 'main' into v1.5771.0
2 parents b7ad87d + c254b81 commit 6f0dfc9

File tree

4 files changed

+16
-54
lines changed

4 files changed

+16
-54
lines changed

packages/clients/src/api/cockpit/v1/api.gen.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
marshalRegionalApiTriggerTestAlertRequest,
2424
marshalRegionalApiUpdateDataSourceRequest,
2525
unmarshalAlertManager,
26-
unmarshalCockpitMetrics,
2726
unmarshalContactPoint,
2827
unmarshalDataSource,
2928
unmarshalGetConfigResponse,
@@ -43,7 +42,6 @@ import {
4342
} from './marshalling.gen'
4443
import type {
4544
AlertManager,
46-
CockpitMetrics,
4745
ContactPoint,
4846
DataSource,
4947
GetConfigResponse,
@@ -80,7 +78,6 @@ import type {
8078
RegionalApiEnableAlertManagerRequest,
8179
RegionalApiEnableManagedAlertsRequest,
8280
RegionalApiGetAlertManagerRequest,
83-
RegionalApiGetCockpitMetricsRequest,
8481
RegionalApiGetConfigRequest,
8582
RegionalApiGetDataSourceRequest,
8683
RegionalApiGetTokenRequest,
@@ -918,24 +915,4 @@ export class RegionalAPI extends ParentAPI {
918915
method: 'POST',
919916
path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/alert-manager/trigger-test-alert`,
920917
})
921-
922-
getCockpitMetrics = (
923-
request: Readonly<RegionalApiGetCockpitMetricsRequest>,
924-
) =>
925-
this.client.fetch<CockpitMetrics>(
926-
{
927-
method: 'GET',
928-
path: `/cockpit/v1beta1/cockpit/metrics`,
929-
urlParams: urlParams(
930-
['end_date', request.endDate],
931-
[
932-
'project_id',
933-
request.projectId ?? this.client.settings.defaultProjectId,
934-
],
935-
['query', request.query],
936-
['start_date', request.startDate],
937-
),
938-
},
939-
unmarshalCockpitMetrics,
940-
)
941918
}

packages/clients/src/api/cockpit/v1/marshalling.gen.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import {
55
resolveOneOf,
66
unmarshalArrayOfObject,
77
unmarshalDate,
8-
unmarshalTimeSeries,
98
} from '../../../bridge'
109
import type { DefaultValues } from '../../../bridge'
1110
import type {
1211
Alert,
1312
AlertManager,
14-
CockpitMetrics,
1513
ContactPoint,
1614
ContactPointEmail,
1715
DataSource,
@@ -180,18 +178,6 @@ export const unmarshalAlertManager = (data: unknown): AlertManager => {
180178
} as AlertManager
181179
}
182180

183-
export const unmarshalCockpitMetrics = (data: unknown): CockpitMetrics => {
184-
if (!isJSONObject(data)) {
185-
throw new TypeError(
186-
`Unmarshalling the type 'CockpitMetrics' failed as data isn't a dictionary.`,
187-
)
188-
}
189-
190-
return {
191-
timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries),
192-
} as CockpitMetrics
193-
}
194-
195181
const unmarshalGetConfigResponseRetention = (
196182
data: unknown,
197183
): GetConfigResponseRetention => {

packages/clients/src/api/cockpit/v1/types.gen.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
3-
import type { Region, TimeSeries } from '../../../bridge'
3+
import type { Region } from '../../../bridge'
44

5-
export type DataSourceOrigin = 'unknown_origin' | 'scaleway' | 'custom'
5+
export type DataSourceOrigin =
6+
| 'unknown_origin'
7+
| 'scaleway'
8+
| 'external'
9+
| 'custom'
610

711
export type DataSourceType = 'unknown_type' | 'metrics' | 'logs' | 'traces'
812

@@ -207,10 +211,6 @@ export interface AlertManager {
207211
region: Region
208212
}
209213

210-
export interface CockpitMetrics {
211-
timeseries: TimeSeries[]
212-
}
213-
214214
/** Cockpit configuration. */
215215
export interface GetConfigResponse {
216216
/** Custom metrics retention configuration. */
@@ -539,13 +539,6 @@ export type RegionalApiGetAlertManagerRequest = {
539539
projectId?: string
540540
}
541541

542-
export type RegionalApiGetCockpitMetricsRequest = {
543-
projectId?: string
544-
startDate?: Date
545-
endDate?: Date
546-
query: string
547-
}
548-
549542
/** Get Cockpit configuration. */
550543
export type RegionalApiGetConfigRequest = {
551544
/**

packages/clients/src/scw/client.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { getLogger } from '../internal/logger'
22
import type { ClientConfig } from './client-ini-factory'
3-
import { withLegacyInterceptors, withProfile } from './client-ini-factory'
4-
import type { Profile } from './client-ini-profile'
3+
import {
4+
withAdditionalInterceptors,
5+
withLegacyInterceptors,
6+
withProfile,
7+
} from './client-ini-factory'
58
import type { Settings } from './client-settings'
69
import { assertValidSettings } from './client-settings'
710
import { userAgent, version } from './constants'
@@ -99,5 +102,8 @@ export const createAdvancedClient = (...configs: ClientConfig[]): Client => {
99102
*
100103
* @public
101104
*/
102-
export const createClient = (profile: Profile = {}): Client =>
103-
createAdvancedClient(withProfile(profile))
105+
export const createClient = (settings: Partial<Settings> = {}): Client =>
106+
createAdvancedClient(
107+
withProfile(settings),
108+
withAdditionalInterceptors(settings.interceptors ?? []),
109+
)

0 commit comments

Comments
 (0)