6e0bb98844
CI / checks (pull_request) Successful in 27m28s
Request public certificates (optionally exportable) or import your own, see each domain's DNS validation records and what uses a certificate, download the certificate and chain, export an exportable one with its encrypted key, and revoke it. ListCertificates asks for every key type, since AWS otherwise leaves EC certificates out.
2257 lines
73 KiB
TypeScript
2257 lines
73 KiB
TypeScript
import { API_BASE_URL, apiClient, apiEndpointKeys } from "./api";
|
|
import type {
|
|
CloudDescriptor,
|
|
CloudProvider,
|
|
CloudServiceDescriptor,
|
|
CloudServiceStatus,
|
|
CloudServiceType,
|
|
CloudStatus,
|
|
RuntimeDiagnostics,
|
|
} from "@/types/cloud";
|
|
import type {
|
|
AppConfigConfigurationProfile,
|
|
AppConfigDeployment,
|
|
AppConfigDeploymentStrategy,
|
|
AppConfigEnvironment,
|
|
AppConfigHostedConfigurationVersion,
|
|
ChildCollection,
|
|
ChildItem,
|
|
CloudResource,
|
|
CollectionPage,
|
|
CosmosContainer,
|
|
CosmosItem,
|
|
CosmosQueryResult,
|
|
CreateDatabaseSnapshotInput,
|
|
CreateKubernetesFargateProfileInput,
|
|
CreateKubernetesNodegroupInput,
|
|
DatabaseSnapshot,
|
|
KubernetesFargateProfile,
|
|
KubernetesNodegroup,
|
|
CreateUserPoolGroupInput,
|
|
UserPoolGroup,
|
|
UserPoolSignInTestInput,
|
|
UserPoolSignInTestResult,
|
|
UserPoolClientSettings,
|
|
DistributionInvalidation,
|
|
CertificatePem,
|
|
CertificateRevocationReason,
|
|
ExportedCertificate,
|
|
AlarmHistoryItem,
|
|
AlarmStateValue,
|
|
MetricSeries,
|
|
MetricSeriesQuery,
|
|
MetricSummary,
|
|
UpdateUserPoolClientOAuthInput,
|
|
UserPoolUserAction,
|
|
LogsInsightsQueryInput,
|
|
LogsInsightsQueryResult,
|
|
LogsFilterInput,
|
|
SqsMessage,
|
|
SqsSendMessageInput,
|
|
SqlCredentials,
|
|
SqlDatabase,
|
|
SqlEngine,
|
|
SqlQueryResult,
|
|
SqlTable,
|
|
StorageObjectList,
|
|
S3BucketWebsiteConfiguration,
|
|
} from "@/types/resource";
|
|
import type { ServiceSchema } from "@/types/schema";
|
|
import { getAccountId } from "@/lib/accountStore";
|
|
|
|
type CloudPathParams = Record<string, string>;
|
|
|
|
const DATABASE_MUTATION_TIMEOUT_MS = 5 * 60_000;
|
|
const LIGHTSAIL_CREATION_TIMEOUT_MS = 3 * 60_000;
|
|
const SQL_DATA_TIMEOUT_MS = 45_000;
|
|
/** Floci completes Insights queries instantly by default, but bounded server-side polling can take longer. */
|
|
const LOGS_QUERY_TIMEOUT_MS = 20_000;
|
|
/** Cold starts pull a container image; measured at ~60s on a first invoke. */
|
|
const INVOKE_TIMEOUT_MS = 120_000;
|
|
|
|
export async function listClouds(
|
|
signal?: AbortSignal,
|
|
): Promise<CloudDescriptor[]> {
|
|
const res = await apiClient.call<CloudDescriptor[]>(
|
|
apiEndpointKeys.clouds.list,
|
|
{ signal },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCloudServices(
|
|
cloud: CloudProvider,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudServiceDescriptor[]> {
|
|
const res = await apiClient.call<CloudServiceDescriptor[]>(
|
|
apiEndpointKeys.clouds.services,
|
|
requestOptions(cloud, "cloud-proxy", { signal }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCloudStatus(
|
|
cloud: CloudProvider,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudStatus> {
|
|
const res = await apiClient.call<CloudStatus>(
|
|
apiEndpointKeys.clouds.status,
|
|
requestOptions(cloud, "cloud-proxy", { signal }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCloudDiagnostics(
|
|
cloud: CloudProvider,
|
|
signal?: AbortSignal,
|
|
): Promise<RuntimeDiagnostics> {
|
|
const res = await apiClient.call<RuntimeDiagnostics>(
|
|
apiEndpointKeys.clouds.diagnostics,
|
|
requestOptions(cloud, "cloud-proxy", { signal }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCloudServiceStatus(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudServiceStatus> {
|
|
const res = await apiClient.call<CloudServiceStatus>(
|
|
apiEndpointKeys.clouds.serviceStatus,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getServiceSchema(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
signal?: AbortSignal,
|
|
): Promise<ServiceSchema> {
|
|
const res = await apiClient.call<ServiceSchema>(
|
|
apiEndpointKeys.clouds.schema,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export type LoadBalancingDependencies = {
|
|
vpcs: Array<{id: string; cidrBlock: string}>;
|
|
subnets: Array<{id: string; vpcId: string; availabilityZone: string; cidrBlock: string}>;
|
|
securityGroups: Array<{id: string; vpcId: string; name: string; description: string}>;
|
|
};
|
|
|
|
export async function getLoadBalancingDependencies(
|
|
service: "loadbalancing" | "targetgroups" = "loadbalancing",
|
|
signal?: AbortSignal,
|
|
): Promise<LoadBalancingDependencies & {instances?: Array<{id: string; name: string; privateIp: string | null}>}> {
|
|
const res = await apiClient.call<LoadBalancingDependencies>(
|
|
apiEndpointKeys.clouds.dependencies,
|
|
requestOptions("aws", service, {signal}),
|
|
{cloud: "aws", service},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCloudResources(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
search?: string,
|
|
signal?: AbortSignal,
|
|
state?: string,
|
|
): Promise<CloudResource[]> {
|
|
const res = await apiClient.call<CloudResource[]>(
|
|
apiEndpointKeys.clouds.resources.list,
|
|
requestOptions(cloud, service, { signal, params: { search, state } }),
|
|
{ cloud, service },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudResource> {
|
|
const res = await apiClient.call<CloudResource>(
|
|
apiEndpointKeys.clouds.resources.get,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service, id },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
values: Record<string, unknown>,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudResource> {
|
|
const timeout =
|
|
(cloud === "azure" || cloud === "aws") && service === "database"
|
|
? DATABASE_MUTATION_TIMEOUT_MS
|
|
: cloud === "aws" && service === "lightsail"
|
|
? LIGHTSAIL_CREATION_TIMEOUT_MS
|
|
: undefined;
|
|
const res = await apiClient.call<CloudResource, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.resources.create,
|
|
requestOptions(cloud, service, { signal, body: values, timeout }),
|
|
{ cloud, service },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function updateCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
values: Record<string, unknown>,
|
|
signal?: AbortSignal,
|
|
): Promise<CloudResource> {
|
|
const timeout =
|
|
(cloud === "azure" || cloud === "aws") && service === "database"
|
|
? DATABASE_MUTATION_TIMEOUT_MS
|
|
: undefined;
|
|
const res = await apiClient.call<CloudResource, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.resources.update,
|
|
requestOptions(cloud, service, { signal, body: values, timeout }),
|
|
{ cloud, service, id },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.delete,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service, id },
|
|
);
|
|
}
|
|
|
|
export async function startCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.start,
|
|
requestOptions(cloud, service),
|
|
{ cloud, service, id },
|
|
);
|
|
}
|
|
|
|
export async function stopCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.stop,
|
|
requestOptions(cloud, service),
|
|
{ cloud, service, id },
|
|
);
|
|
}
|
|
|
|
export async function rebootCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.reboot,
|
|
requestOptions(cloud, service),
|
|
{ cloud, service, id },
|
|
);
|
|
}
|
|
|
|
export async function clearEmailInbox(
|
|
cloud: CloudProvider,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.email.inbox.clear,
|
|
requestOptions(cloud, "email", { signal }),
|
|
{ cloud },
|
|
);
|
|
}
|
|
export interface ServerlessInvokeResult {
|
|
statusCode: number;
|
|
payload: string;
|
|
functionError?: string;
|
|
logResult?: string;
|
|
executionDuration?: number;
|
|
}
|
|
|
|
export interface PublishNotificationInput {
|
|
message: string;
|
|
subject?: string;
|
|
messageAttributes?: Record<string, string>;
|
|
}
|
|
|
|
export interface PublishNotificationResult {
|
|
messageId: string | null;
|
|
}
|
|
|
|
export interface WorkflowExecutionSummary {
|
|
executionArn: string;
|
|
name: string;
|
|
status: string;
|
|
startDate: string;
|
|
stopDate?: string;
|
|
}
|
|
|
|
export interface WorkflowExecutionDetail extends WorkflowExecutionSummary {
|
|
stateMachineArn: string;
|
|
input?: string;
|
|
output?: string;
|
|
error?: string;
|
|
cause?: string;
|
|
}
|
|
|
|
export interface WorkflowExecutionHistoryPage {
|
|
events: Array<Record<string, unknown>>;
|
|
nextToken?: string;
|
|
}
|
|
|
|
export interface CodeBuildEnvironmentVariableOverride {
|
|
name: string;
|
|
value: string;
|
|
type?: "PLAINTEXT" | "PARAMETER_STORE" | "SECRETS_MANAGER";
|
|
}
|
|
|
|
export interface CodeBuildBuild {
|
|
id: string;
|
|
arn?: string;
|
|
projectName: string;
|
|
buildNumber?: number;
|
|
buildStatus?: string;
|
|
currentPhase?: string;
|
|
startTime?: string;
|
|
endTime?: string;
|
|
phases: Array<{phaseType: string; phaseStatus?: string; startTime?: string; endTime?: string; contexts: Array<{statusCode?: string; message?: string}>}>;
|
|
logGroupName?: string;
|
|
logStreamName?: string;
|
|
}
|
|
|
|
export interface PipelineExecutionSummary {
|
|
id: string;
|
|
status?: string;
|
|
statusSummary?: string;
|
|
startTime?: string;
|
|
lastUpdateTime?: string;
|
|
}
|
|
|
|
export interface PipelineState {
|
|
stages: Array<{
|
|
name: string;
|
|
status?: string;
|
|
lastStatusChange?: string;
|
|
actions: Array<{name: string; status?: string; summary?: string; lastStatusChange?: string; externalExecutionId?: string; externalExecutionUrl?: string; entityUrl?: string; revisionUrl?: string; codeBuildProject?: string; codeDeployDeploymentId?: string; codeDeployApplication?: string; codeDeployDeploymentGroup?: string}>;
|
|
}>;
|
|
}
|
|
|
|
export interface CodeDeployDeployment { id: string; applicationName: string; deploymentGroupName: string; status: string | null; creator: string | null; deploymentConfigName: string | null; createTime?: string; completeTime?: string; errorInformation: {code?: string; message?: string} | null; currentVersion: string | null; targetVersion: string | null; trafficPercent: number | null }
|
|
export interface StartCodeDeployDeploymentInput { functionName: string; alias: string; currentVersion: string; targetVersion: string; beforeAllowTrafficHook?: string; afterAllowTrafficHook?: string }
|
|
export interface CodeDeployDependencies { lambdaFunctions: Array<{name: string; aliases: string[]; versions: string[]}> }
|
|
|
|
export interface CreateApiGatewayLambdaRouteInput {
|
|
path: string;
|
|
parentResourceId?: string;
|
|
pathPart?: string;
|
|
method: string;
|
|
stage: string;
|
|
functionName: string;
|
|
}
|
|
|
|
export interface ApiGatewayLambdaRoute {
|
|
resourceId: string;
|
|
deploymentId: string;
|
|
invokeUrl: string;
|
|
}
|
|
|
|
export interface TestApiGatewayRouteInput {
|
|
path: string;
|
|
method: string;
|
|
stage: string;
|
|
body: string;
|
|
headers: Record<string, string>;
|
|
query: string;
|
|
}
|
|
|
|
export interface ApiGatewayTestRouteResult {
|
|
statusCode: number;
|
|
headers: Record<string, string>;
|
|
body: string;
|
|
durationMs: number;
|
|
}
|
|
|
|
export interface TestApiGatewayMethodInput {
|
|
resourceId: string;
|
|
httpMethod: string;
|
|
pathWithQueryString: string;
|
|
body: string;
|
|
headers: Record<string, string>;
|
|
multiValueHeaders: Record<string, string[]>;
|
|
stageVariables: Record<string, string>;
|
|
}
|
|
|
|
export interface ApiGatewayMethodTestResult {
|
|
statusCode: number;
|
|
body: string;
|
|
headers: Record<string, string>;
|
|
multiValueHeaders: Record<string, string[]>;
|
|
log: string | null;
|
|
latency: number | null;
|
|
}
|
|
|
|
export interface ApiGatewayRouteOverview {
|
|
resourceId: string;
|
|
path: string;
|
|
method: string;
|
|
functionName: string | null;
|
|
integrationType: string | null;
|
|
}
|
|
|
|
export interface ApiGatewayResourceOverview {
|
|
resourceId: string;
|
|
parentId: string | null;
|
|
path: string;
|
|
pathPart: string | null;
|
|
methods: ApiGatewayRouteOverview[];
|
|
}
|
|
|
|
export interface ApiGatewayRoutesResult {
|
|
resources: ApiGatewayResourceOverview[];
|
|
routes: ApiGatewayRouteOverview[];
|
|
stages: string[];
|
|
}
|
|
|
|
export interface DeleteApiGatewayRouteInput {
|
|
resourceId: string;
|
|
path: string;
|
|
method: string;
|
|
stage: string;
|
|
}
|
|
|
|
export interface EnableApiGatewayCorsInput {
|
|
resourceId: string;
|
|
stage: string;
|
|
origin: string;
|
|
headers: string;
|
|
methods: string[];
|
|
}
|
|
|
|
export interface ApiGatewayCorsResult {
|
|
configuredMethods: string[];
|
|
proxyMethods: string[];
|
|
}
|
|
|
|
export interface CreateS3LambdaTriggerInput {
|
|
functionName: string;
|
|
events: string[];
|
|
prefix?: string;
|
|
suffix?: string;
|
|
}
|
|
|
|
export interface S3LambdaTriggerOverview {
|
|
id: string;
|
|
functionName: string;
|
|
functionArn: string;
|
|
events: string[];
|
|
prefix: string | null;
|
|
suffix: string | null;
|
|
}
|
|
|
|
export interface CreateSnsSubscriptionInput {
|
|
protocol: string;
|
|
endpoint: string;
|
|
}
|
|
|
|
export interface SnsSubscriptionOverview {
|
|
arn: string | null;
|
|
protocol: string;
|
|
endpoint: string;
|
|
status: "Confirmed" | "PendingConfirmation";
|
|
filterPolicy: string | null;
|
|
}
|
|
|
|
export interface CreateEventBridgeLambdaTriggerInput {
|
|
ruleName: string;
|
|
scheduleExpression: string;
|
|
}
|
|
|
|
export interface EventBridgeLambdaTriggerOverview {
|
|
id: string;
|
|
ruleName: string;
|
|
ruleArn: string;
|
|
functionName: string;
|
|
functionArn: string;
|
|
scheduleExpression: string;
|
|
state: string | null;
|
|
}
|
|
|
|
export interface EventBridgeRuleTarget {
|
|
id: string;
|
|
arn: string;
|
|
}
|
|
|
|
export interface CreateEventBridgeRuleInput {
|
|
name: string;
|
|
scheduleExpression?: string;
|
|
eventPattern?: string;
|
|
state?: "ENABLED" | "DISABLED";
|
|
description?: string;
|
|
targets: EventBridgeRuleTarget[];
|
|
}
|
|
|
|
export interface EventBridgeRuleOverview extends CreateEventBridgeRuleInput {
|
|
busName: string;
|
|
busId: string;
|
|
arn: string | null;
|
|
state: "ENABLED" | "DISABLED";
|
|
}
|
|
|
|
export interface PutEventBridgeEventInput {
|
|
source: string;
|
|
detailType: string;
|
|
detail: string;
|
|
resources?: string[];
|
|
}
|
|
|
|
export interface PutEventBridgeEventResult {
|
|
eventId: string | null;
|
|
errorCode: string | null;
|
|
errorMessage: string | null;
|
|
}
|
|
export interface CloudFormationChangeSet { name: string; id: string; status: string | null; executionStatus: string | null; changes: Array<{action: string | null; logicalResourceId: string | null; resourceType: string | null}> }
|
|
|
|
export interface CreateSqsLambdaEventSourceMappingInput {
|
|
queueArn: string;
|
|
batchSize?: number;
|
|
}
|
|
|
|
export interface SqsLambdaEventSourceMappingOverview {
|
|
id: string;
|
|
uuid: string;
|
|
functionName: string;
|
|
functionArn: string | null;
|
|
queueArn: string;
|
|
batchSize: number | null;
|
|
state: string | null;
|
|
stateTransitionReason: string | null;
|
|
}
|
|
|
|
export interface KinesisRecord {sequenceNumber: string; partitionKey: string | null; data: string; approximateArrivalTimestamp: string | null}
|
|
export interface LambdaEventSourceMappingOverview {id: string; uuid: string; functionName: string | null; functionArn: string | null; eventSourceArn: string; batchSize: number | null; startingPosition: string | null; state: string | null; stateTransitionReason: string | null}
|
|
export interface CreateLambdaEventSourceMappingInput {functionName: string; eventSourceArn: string; batchSize?: number; startingPosition?: "TRIM_HORIZON" | "LATEST"}
|
|
|
|
export async function putKinesisRecord(cloud: CloudProvider, streamName: string, input: {partitionKey: string; data: string}): Promise<{sequenceNumber: string; shardId: string}> {
|
|
const res = await apiClient.call<{sequenceNumber: string; shardId: string}, typeof input>(apiEndpointKeys.clouds.resources.putKinesisRecord, requestOptions(cloud, "kinesis", {body: input}), {cloud, id: streamName})
|
|
return res.data
|
|
}
|
|
|
|
export async function listKinesisRecords(cloud: CloudProvider, streamName: string, signal?: AbortSignal): Promise<KinesisRecord[]> {
|
|
const res = await apiClient.call<KinesisRecord[]>(apiEndpointKeys.clouds.resources.listKinesisRecords, requestOptions(cloud, "kinesis", {signal}), {cloud, id: streamName})
|
|
return res.data
|
|
}
|
|
|
|
export async function createLambdaEventSourceMapping(cloud: CloudProvider, input: CreateLambdaEventSourceMappingInput): Promise<LambdaEventSourceMappingOverview> {
|
|
const res = await apiClient.call<LambdaEventSourceMappingOverview, CreateLambdaEventSourceMappingInput>(apiEndpointKeys.clouds.resources.createLambdaEventSourceMapping, requestOptions(cloud, "serverless", {body: input}), {cloud})
|
|
return res.data
|
|
}
|
|
|
|
export async function listLambdaEventSourceMappings(cloud: CloudProvider, filter: {functionName?: string; eventSourceArn?: string}, signal?: AbortSignal): Promise<LambdaEventSourceMappingOverview[]> {
|
|
const res = await apiClient.call<LambdaEventSourceMappingOverview[]>(apiEndpointKeys.clouds.resources.listLambdaEventSourceMappings, requestOptions(cloud, "serverless", {signal, params: filter}), {cloud})
|
|
return res.data
|
|
}
|
|
|
|
export async function updateLambdaEventSourceMapping(cloud: CloudProvider, mappingId: string, input: {batchSize?: number; enabled?: boolean}): Promise<LambdaEventSourceMappingOverview> {
|
|
const res = await apiClient.call<LambdaEventSourceMappingOverview, typeof input>(apiEndpointKeys.clouds.resources.updateLambdaEventSourceMapping, requestOptions(cloud, "serverless", {body: input}), {cloud, mappingId})
|
|
return res.data
|
|
}
|
|
|
|
export async function deleteLambdaEventSourceMapping(cloud: CloudProvider, mappingId: string): Promise<void> {
|
|
await apiClient.call<void>(apiEndpointKeys.clouds.resources.deleteLambdaEventSourceMapping, requestOptions(cloud, "serverless"), {cloud, mappingId})
|
|
}
|
|
|
|
export async function createApiGatewayLambdaRoute(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
input: CreateApiGatewayLambdaRouteInput,
|
|
signal?: AbortSignal,
|
|
): Promise<ApiGatewayLambdaRoute> {
|
|
const res = await apiClient.call<ApiGatewayLambdaRoute, CreateApiGatewayLambdaRouteInput>(
|
|
apiEndpointKeys.clouds.resources.createApiGatewayRoute,
|
|
requestOptions(cloud, "apigateway", { signal, body: input }),
|
|
{ cloud, id: apiId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listApiGatewayRoutes(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<ApiGatewayRoutesResult> {
|
|
const res = await apiClient.call<ApiGatewayRoutesResult>(
|
|
apiEndpointKeys.clouds.resources.listApiGatewayRoutes,
|
|
requestOptions(cloud, "apigateway", { signal }),
|
|
{ cloud, id: apiId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteApiGatewayRoute(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
input: DeleteApiGatewayRouteInput,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteApiGatewayRoute,
|
|
requestOptions(cloud, "apigateway", {signal, params: {stage: input.stage, path: input.path}}),
|
|
{cloud, id: apiId, resourceId: input.resourceId, method: input.method},
|
|
);
|
|
}
|
|
|
|
export async function enableApiGatewayCors(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
input: EnableApiGatewayCorsInput,
|
|
signal?: AbortSignal,
|
|
): Promise<ApiGatewayCorsResult> {
|
|
const res = await apiClient.call<ApiGatewayCorsResult, EnableApiGatewayCorsInput>(
|
|
apiEndpointKeys.clouds.resources.enableApiGatewayCors,
|
|
requestOptions(cloud, "apigateway", {signal, body: input}),
|
|
{cloud, id: apiId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function testApiGatewayRoute(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
input: TestApiGatewayRouteInput,
|
|
signal?: AbortSignal,
|
|
): Promise<ApiGatewayTestRouteResult> {
|
|
const res = await apiClient.call<ApiGatewayTestRouteResult, TestApiGatewayRouteInput>(
|
|
apiEndpointKeys.clouds.resources.testApiGatewayRoute,
|
|
requestOptions(cloud, "apigateway", { signal, body: input, timeout: INVOKE_TIMEOUT_MS }),
|
|
{ cloud, id: apiId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function testApiGatewayMethod(
|
|
cloud: CloudProvider,
|
|
apiId: string,
|
|
input: TestApiGatewayMethodInput,
|
|
signal?: AbortSignal,
|
|
): Promise<ApiGatewayMethodTestResult> {
|
|
const res = await apiClient.call<ApiGatewayMethodTestResult, TestApiGatewayMethodInput>(
|
|
apiEndpointKeys.clouds.resources.testApiGatewayMethod,
|
|
requestOptions(cloud, "apigateway", { signal, body: input, timeout: INVOKE_TIMEOUT_MS }),
|
|
{ cloud, id: apiId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createS3LambdaTrigger(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
input: CreateS3LambdaTriggerInput,
|
|
signal?: AbortSignal,
|
|
): Promise<S3LambdaTriggerOverview> {
|
|
const res = await apiClient.call<S3LambdaTriggerOverview, CreateS3LambdaTriggerInput>(
|
|
apiEndpointKeys.clouds.resources.createS3LambdaTrigger,
|
|
requestOptions(cloud, "storage", {signal, body: input}),
|
|
{cloud, id: bucketName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listS3LambdaTriggers(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<S3LambdaTriggerOverview[]> {
|
|
const res = await apiClient.call<S3LambdaTriggerOverview[]>(
|
|
apiEndpointKeys.clouds.resources.listS3LambdaTriggers,
|
|
requestOptions(cloud, "storage", {signal}),
|
|
{cloud, id: bucketName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteS3LambdaTrigger(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
triggerId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteS3LambdaTrigger,
|
|
requestOptions(cloud, "storage", {signal}),
|
|
{cloud, id: bucketName, triggerId},
|
|
);
|
|
}
|
|
|
|
export async function getS3BucketWebsite(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<S3BucketWebsiteConfiguration | null> {
|
|
const res = await apiClient.call<S3BucketWebsiteConfiguration | null>(
|
|
apiEndpointKeys.clouds.resources.getS3BucketWebsite,
|
|
requestOptions(cloud, "storage", {signal}),
|
|
{cloud, id: bucketName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function putS3BucketWebsite(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
configuration: S3BucketWebsiteConfiguration,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void, S3BucketWebsiteConfiguration>(
|
|
apiEndpointKeys.clouds.resources.putS3BucketWebsite,
|
|
requestOptions(cloud, "storage", {signal, body: configuration}),
|
|
{cloud, id: bucketName},
|
|
);
|
|
}
|
|
|
|
export async function deleteS3BucketWebsite(
|
|
cloud: CloudProvider,
|
|
bucketName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteS3BucketWebsite,
|
|
requestOptions(cloud, "storage", {signal}),
|
|
{cloud, id: bucketName},
|
|
);
|
|
}
|
|
|
|
export async function createSnsSubscription(
|
|
cloud: CloudProvider,
|
|
topicArn: string,
|
|
input: CreateSnsSubscriptionInput,
|
|
signal?: AbortSignal,
|
|
): Promise<SnsSubscriptionOverview> {
|
|
const res = await apiClient.call<SnsSubscriptionOverview, CreateSnsSubscriptionInput>(
|
|
apiEndpointKeys.clouds.resources.createSnsSubscription,
|
|
requestOptions(cloud, "notifications", {signal, body: input}),
|
|
{cloud, id: topicArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listSnsSubscriptions(
|
|
cloud: CloudProvider,
|
|
topicArn: string,
|
|
signal?: AbortSignal,
|
|
): Promise<SnsSubscriptionOverview[]> {
|
|
const res = await apiClient.call<SnsSubscriptionOverview[]>(
|
|
apiEndpointKeys.clouds.resources.listSnsSubscriptions,
|
|
requestOptions(cloud, "notifications", {signal}),
|
|
{cloud, id: topicArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteSnsSubscription(
|
|
cloud: CloudProvider,
|
|
topicArn: string,
|
|
subscriptionArn: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteSnsSubscription,
|
|
requestOptions(cloud, "notifications", {signal}),
|
|
{cloud, id: topicArn, subscriptionArn},
|
|
);
|
|
}
|
|
|
|
export async function createEventBridgeLambdaTrigger(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
input: CreateEventBridgeLambdaTriggerInput,
|
|
signal?: AbortSignal,
|
|
): Promise<EventBridgeLambdaTriggerOverview> {
|
|
const res = await apiClient.call<EventBridgeLambdaTriggerOverview, CreateEventBridgeLambdaTriggerInput>(
|
|
apiEndpointKeys.clouds.resources.createEventBridgeLambdaTrigger,
|
|
requestOptions(cloud, "serverless", {signal, body: input}),
|
|
{cloud, id: functionName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listEventBridgeLambdaTriggers(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<EventBridgeLambdaTriggerOverview[]> {
|
|
const res = await apiClient.call<EventBridgeLambdaTriggerOverview[]>(
|
|
apiEndpointKeys.clouds.resources.listEventBridgeLambdaTriggers,
|
|
requestOptions(cloud, "serverless", {signal}),
|
|
{cloud, id: functionName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteEventBridgeLambdaTrigger(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
triggerId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteEventBridgeLambdaTrigger,
|
|
requestOptions(cloud, "serverless", {signal}),
|
|
{cloud, id: functionName, triggerId},
|
|
);
|
|
}
|
|
|
|
export async function createEventBridgeRule(
|
|
cloud: CloudProvider,
|
|
eventBusId: string,
|
|
input: CreateEventBridgeRuleInput,
|
|
signal?: AbortSignal,
|
|
): Promise<EventBridgeRuleOverview> {
|
|
const res = await apiClient.call<EventBridgeRuleOverview, CreateEventBridgeRuleInput>(
|
|
apiEndpointKeys.clouds.resources.createEventBridgeRule,
|
|
requestOptions(cloud, "events", {signal, body: input}),
|
|
{cloud, id: eventBusId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listEventBridgeRules(
|
|
cloud: CloudProvider,
|
|
eventBusId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<EventBridgeRuleOverview[]> {
|
|
const res = await apiClient.call<EventBridgeRuleOverview[]>(
|
|
apiEndpointKeys.clouds.resources.listEventBridgeRules,
|
|
requestOptions(cloud, "events", {signal}),
|
|
{cloud, id: eventBusId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteEventBridgeRule(
|
|
cloud: CloudProvider,
|
|
eventBusId: string,
|
|
ruleName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteEventBridgeRule,
|
|
requestOptions(cloud, "events", {signal}),
|
|
{cloud, id: eventBusId, ruleName},
|
|
);
|
|
}
|
|
|
|
export async function putEventBridgeEvent(
|
|
cloud: CloudProvider,
|
|
eventBusId: string,
|
|
input: PutEventBridgeEventInput,
|
|
signal?: AbortSignal,
|
|
): Promise<PutEventBridgeEventResult> {
|
|
const res = await apiClient.call<PutEventBridgeEventResult, PutEventBridgeEventInput>(
|
|
apiEndpointKeys.clouds.resources.putEventBridgeEvent,
|
|
requestOptions(cloud, "events", {signal, body: input}),
|
|
{cloud, id: eventBusId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCloudFormationChangeSets(cloud: CloudProvider, stackName: string, signal?: AbortSignal): Promise<CloudFormationChangeSet[]> { const res = await apiClient.call<CloudFormationChangeSet[]>(apiEndpointKeys.clouds.resources.listCloudFormationChangeSets, requestOptions(cloud, 'iac', {signal}), {cloud, id: stackName}); return res.data }
|
|
export async function createCloudFormationChangeSet(cloud: CloudProvider, stackName: string, input: {name: string; templateBody: string; parameters?: Record<string, string>; capabilities?: string[]}): Promise<CloudFormationChangeSet> { const res = await apiClient.call<CloudFormationChangeSet, typeof input>(apiEndpointKeys.clouds.resources.createCloudFormationChangeSet, requestOptions(cloud, 'iac', {body: input}), {cloud, id: stackName}); return res.data }
|
|
export async function executeCloudFormationChangeSet(cloud: CloudProvider, stackName: string, name: string): Promise<void> { await apiClient.call<void>(apiEndpointKeys.clouds.resources.executeCloudFormationChangeSet, requestOptions(cloud, 'iac', {}), {cloud, id: stackName, name}) }
|
|
export async function deleteCloudFormationChangeSet(cloud: CloudProvider, stackName: string, name: string): Promise<void> { await apiClient.call<void>(apiEndpointKeys.clouds.resources.deleteCloudFormationChangeSet, requestOptions(cloud, 'iac', {}), {cloud, id: stackName, name}) }
|
|
export async function updateCloudFormationTerminationProtection(cloud: CloudProvider, stackName: string, enabled: boolean): Promise<void> { await apiClient.call<void, {enabled: boolean}>(apiEndpointKeys.clouds.resources.updateCloudFormationTerminationProtection, requestOptions(cloud, 'iac', {body: {enabled}}), {cloud, id: stackName}) }
|
|
|
|
export async function createSqsLambdaEventSourceMapping(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
input: CreateSqsLambdaEventSourceMappingInput,
|
|
signal?: AbortSignal,
|
|
): Promise<SqsLambdaEventSourceMappingOverview> {
|
|
const res = await apiClient.call<SqsLambdaEventSourceMappingOverview, CreateSqsLambdaEventSourceMappingInput>(
|
|
apiEndpointKeys.clouds.resources.createSqsLambdaEventSourceMapping,
|
|
requestOptions(cloud, "serverless", {signal, body: input}),
|
|
{cloud, id: functionName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listSqsLambdaEventSourceMappings(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<SqsLambdaEventSourceMappingOverview[]> {
|
|
const res = await apiClient.call<SqsLambdaEventSourceMappingOverview[]>(
|
|
apiEndpointKeys.clouds.resources.listSqsLambdaEventSourceMappings,
|
|
requestOptions(cloud, "serverless", {signal}),
|
|
{cloud, id: functionName},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteSqsLambdaEventSourceMapping(
|
|
cloud: CloudProvider,
|
|
functionName: string,
|
|
mappingId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.deleteSqsLambdaEventSourceMapping,
|
|
requestOptions(cloud, "serverless", {signal}),
|
|
{cloud, id: functionName, mappingId},
|
|
);
|
|
}
|
|
|
|
export type KmsEncryptionAlgorithm =
|
|
| "SYMMETRIC_DEFAULT"
|
|
| "RSAES_OAEP_SHA_1"
|
|
| "RSAES_OAEP_SHA_256";
|
|
|
|
export interface KmsEncryptRequest {
|
|
plaintextBase64: string;
|
|
encryptionAlgorithm: KmsEncryptionAlgorithm;
|
|
encryptionContext?: Record<string, string>;
|
|
}
|
|
|
|
export interface KmsEncryptResponse {
|
|
ciphertextBlobBase64: string;
|
|
keyId: string;
|
|
encryptionAlgorithm: KmsEncryptionAlgorithm;
|
|
}
|
|
|
|
export interface KmsDecryptRequest {
|
|
ciphertextBlobBase64: string;
|
|
encryptionAlgorithm: KmsEncryptionAlgorithm;
|
|
encryptionContext?: Record<string, string>;
|
|
}
|
|
|
|
export interface KmsDecryptResponse {
|
|
plaintextBase64: string;
|
|
keyId: string;
|
|
encryptionAlgorithm: KmsEncryptionAlgorithm;
|
|
}
|
|
|
|
export async function invokeCloudResource(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
id: string,
|
|
payload: string,
|
|
signal?: AbortSignal,
|
|
): Promise<ServerlessInvokeResult> {
|
|
const res = await apiClient.call<ServerlessInvokeResult, { payload: string }>(
|
|
apiEndpointKeys.clouds.resources.invoke,
|
|
requestOptions(cloud, service, {
|
|
signal,
|
|
body: { payload },
|
|
// A cold invoke can exceed a minute while the runtime pulls and starts the
|
|
// function container, so the 10s default would abort a request that is
|
|
// working. The user-visible alternative is a timeout error for a function
|
|
// that in fact ran.
|
|
timeout: INVOKE_TIMEOUT_MS,
|
|
}),
|
|
{ cloud, service, id },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function startWorkflowExecution(
|
|
stateMachineArn: string,
|
|
input: {input: string; name?: string},
|
|
): Promise<{executionArn: string; startDate: string}> {
|
|
const res = await apiClient.call<{executionArn: string; startDate: string}, {input: string; name?: string}>(
|
|
apiEndpointKeys.clouds.resources.startWorkflowExecution,
|
|
requestOptions("aws", "workflows", {body: input}),
|
|
{cloud: "aws", id: stateMachineArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listWorkflowExecutions(stateMachineArn: string, signal?: AbortSignal): Promise<WorkflowExecutionSummary[]> {
|
|
const res = await apiClient.call<WorkflowExecutionSummary[]>(
|
|
apiEndpointKeys.clouds.resources.listWorkflowExecutions,
|
|
requestOptions("aws", "workflows", {signal}),
|
|
{cloud: "aws", id: stateMachineArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function describeWorkflowExecution(stateMachineArn: string, executionArn: string, signal?: AbortSignal): Promise<WorkflowExecutionDetail> {
|
|
const res = await apiClient.call<WorkflowExecutionDetail>(
|
|
apiEndpointKeys.clouds.resources.describeWorkflowExecution,
|
|
requestOptions("aws", "workflows", {signal}),
|
|
{cloud: "aws", id: stateMachineArn, executionArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getWorkflowExecutionHistory(stateMachineArn: string, executionArn: string, nextToken?: string, signal?: AbortSignal): Promise<WorkflowExecutionHistoryPage> {
|
|
const res = await apiClient.call<WorkflowExecutionHistoryPage>(
|
|
apiEndpointKeys.clouds.resources.getWorkflowExecutionHistory,
|
|
requestOptions("aws", "workflows", {signal, params: {nextToken}}),
|
|
{cloud: "aws", id: stateMachineArn, executionArn},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function stopWorkflowExecution(stateMachineArn: string, executionArn: string): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.resources.stopWorkflowExecution,
|
|
requestOptions("aws", "workflows"),
|
|
{cloud: "aws", id: stateMachineArn, executionArn},
|
|
);
|
|
}
|
|
|
|
export async function startCodeBuild(projectName: string, input: {environmentVariablesOverride?: CodeBuildEnvironmentVariableOverride[]; buildspecOverride?: string}): Promise<CodeBuildBuild> {
|
|
const res = await apiClient.call<CodeBuildBuild, typeof input>(apiEndpointKeys.clouds.resources.startCodeBuild, requestOptions("aws", "codebuild", {body: input}), {cloud: "aws", id: projectName});
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCodeBuilds(projectName: string, signal?: AbortSignal): Promise<CodeBuildBuild[]> {
|
|
const res = await apiClient.call<CodeBuildBuild[]>(apiEndpointKeys.clouds.resources.listCodeBuilds, requestOptions("aws", "codebuild", {signal}), {cloud: "aws", id: projectName});
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCodeBuild(projectName: string, buildId: string, signal?: AbortSignal): Promise<CodeBuildBuild> {
|
|
const res = await apiClient.call<CodeBuildBuild>(apiEndpointKeys.clouds.resources.getCodeBuild, requestOptions("aws", "codebuild", {signal}), {cloud: "aws", id: projectName, buildId});
|
|
return res.data;
|
|
}
|
|
|
|
export async function startCodePipeline(name: string): Promise<{id: string}> {
|
|
const res = await apiClient.call<{id: string}>(apiEndpointKeys.clouds.resources.startCodePipeline, requestOptions('aws', 'codepipeline'), {cloud: 'aws', id: name});
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCodePipelineExecutions(name: string, signal?: AbortSignal): Promise<PipelineExecutionSummary[]> {
|
|
const res = await apiClient.call<PipelineExecutionSummary[]>(apiEndpointKeys.clouds.resources.listCodePipelineExecutions, requestOptions('aws', 'codepipeline', {signal}), {cloud: 'aws', id: name});
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCodePipelineState(name: string, signal?: AbortSignal): Promise<PipelineState> {
|
|
const res = await apiClient.call<PipelineState>(apiEndpointKeys.clouds.resources.getCodePipelineState, requestOptions('aws', 'codepipeline', {signal}), {cloud: 'aws', id: name});
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCodeDeployDependencies(signal?: AbortSignal): Promise<CodeDeployDependencies> { const res = await apiClient.call<CodeDeployDependencies>(apiEndpointKeys.clouds.dependencies, requestOptions('aws', 'codedeploy', {signal}), {cloud: 'aws', service: 'codedeploy'}); return res.data }
|
|
export async function startCodeDeployDeployment(groupId: string, input: StartCodeDeployDeploymentInput): Promise<CodeDeployDeployment> { const res = await apiClient.call<CodeDeployDeployment, StartCodeDeployDeploymentInput>(apiEndpointKeys.clouds.resources.startCodeDeployDeployment, requestOptions('aws', 'codedeploy', {body: input}), {cloud: 'aws', id: groupId}); return res.data }
|
|
export async function listCodeDeployDeployments(groupId: string, signal?: AbortSignal): Promise<CodeDeployDeployment[]> { const res = await apiClient.call<CodeDeployDeployment[]>(apiEndpointKeys.clouds.resources.listCodeDeployDeployments, requestOptions('aws', 'codedeploy', {signal}), {cloud: 'aws', id: groupId}); return res.data }
|
|
export async function getCodeDeployDeployment(id: string, signal?: AbortSignal): Promise<CodeDeployDeployment> { const res = await apiClient.call<CodeDeployDeployment>(apiEndpointKeys.clouds.resources.getCodeDeployDeployment, requestOptions('aws', 'codedeploy', {signal}), {cloud: 'aws', deploymentId: id}); return res.data }
|
|
export async function stopCodeDeployDeployment(id: string, rollback: boolean): Promise<void> { await apiClient.call<void, {rollback: boolean}>(apiEndpointKeys.clouds.resources.stopCodeDeployDeployment, requestOptions('aws', 'codedeploy', {body: {rollback}}), {cloud: 'aws', deploymentId: id}) }
|
|
|
|
export async function publishNotification(
|
|
cloud: CloudProvider,
|
|
topicArn: string,
|
|
input: PublishNotificationInput,
|
|
signal?: AbortSignal,
|
|
): Promise<PublishNotificationResult> {
|
|
const res = await apiClient.call<PublishNotificationResult, PublishNotificationInput>(
|
|
apiEndpointKeys.clouds.resources.publish,
|
|
requestOptions(cloud, "notifications", { signal, body: input }),
|
|
{ cloud, id: topicArn },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function encryptKmsResource(
|
|
cloud: CloudProvider,
|
|
id: string,
|
|
body: KmsEncryptRequest,
|
|
signal?: AbortSignal,
|
|
): Promise<KmsEncryptResponse> {
|
|
const res = await apiClient.call<KmsEncryptResponse, KmsEncryptRequest>(
|
|
apiEndpointKeys.clouds.resources.encrypt,
|
|
requestOptions(cloud, "kms", { signal, body }),
|
|
{ cloud, id },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function decryptKmsResource(
|
|
cloud: CloudProvider,
|
|
id: string,
|
|
body: KmsDecryptRequest,
|
|
signal?: AbortSignal,
|
|
): Promise<KmsDecryptResponse> {
|
|
const res = await apiClient.call<KmsDecryptResponse, KmsDecryptRequest>(
|
|
apiEndpointKeys.clouds.resources.decrypt,
|
|
requestOptions(cloud, "kms", { signal, body }),
|
|
{ cloud, id },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listStorageObjects(
|
|
cloud: CloudProvider,
|
|
resourceId: string,
|
|
prefix?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<StorageObjectList> {
|
|
const res = await apiClient.call<StorageObjectList>(
|
|
apiEndpointKeys.clouds.storage.objects.list,
|
|
requestOptions(cloud, "storage", { signal, params: { prefix } }),
|
|
storagePathParams(cloud, resourceId),
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function uploadStorageObject(
|
|
cloud: CloudProvider,
|
|
resourceId: string,
|
|
key: string,
|
|
file: File | Blob,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.storage.objects.upload,
|
|
requestOptions(cloud, "storage", {
|
|
signal,
|
|
rawBody: file,
|
|
params: { key },
|
|
headers: { "Content-Type": file.type || "application/octet-stream" },
|
|
}),
|
|
storagePathParams(cloud, resourceId),
|
|
);
|
|
}
|
|
|
|
export type LightsailStaticDeployment = {status: 'deployed'; files: number}
|
|
export type LightsailNodeDeployment = {status: 'deployed'; files: number; port: number; releaseId: string}
|
|
|
|
export async function deployLightsailStaticFiles(instanceId: string, files: File[]): Promise<LightsailStaticDeployment> {
|
|
const form = new FormData()
|
|
for (const file of files) {
|
|
const path = file.webkitRelativePath || file.name
|
|
form.append('files', file, path)
|
|
}
|
|
const res = await apiClient.call<LightsailStaticDeployment>(
|
|
apiEndpointKeys.clouds.resources.deployLightsailStaticFiles,
|
|
requestOptions('aws', 'lightsail', {rawBody: form}),
|
|
{id: instanceId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export async function deployLightsailNodeApplication(instanceId: string, files: File[], startCommand: string, port: number): Promise<LightsailNodeDeployment> {
|
|
const form = new FormData()
|
|
for (const file of files) form.append('files', file, file.webkitRelativePath || file.name)
|
|
if (startCommand.trim()) form.append('startCommand', startCommand.trim())
|
|
form.append('port', String(port))
|
|
const res = await apiClient.call<LightsailNodeDeployment>(
|
|
apiEndpointKeys.clouds.resources.deployLightsailNodeApplication,
|
|
requestOptions('aws', 'lightsail', {rawBody: form, timeout: 370_000}),
|
|
{id: instanceId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export function storageObjectDownloadUrl(
|
|
cloud: CloudProvider,
|
|
resourceId: string,
|
|
key: string,
|
|
): string {
|
|
const path = `/clouds/${encodeURIComponent(
|
|
cloud,
|
|
)}/services/storage/resources/${encodeURIComponent(resourceId)}/object`;
|
|
// This URL is opened directly by the browser (anchor/img), so it bypasses the
|
|
// request interceptor — pass the account as a query param the API also reads.
|
|
return `${API_BASE_URL}${path}?key=${encodeURIComponent(
|
|
key,
|
|
)}&account=${encodeURIComponent(getAccountId())}`;
|
|
}
|
|
|
|
export async function deleteStorageObject(
|
|
cloud: CloudProvider,
|
|
resourceId: string,
|
|
key: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.storage.objects.delete,
|
|
requestOptions(cloud, "storage", { signal, params: { key } }),
|
|
storagePathParams(cloud, resourceId),
|
|
);
|
|
}
|
|
|
|
export async function copyStorageObject(
|
|
cloud: CloudProvider,
|
|
srcResourceId: string,
|
|
srcKey: string,
|
|
destKey: string,
|
|
destResourceId?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.storage.objects.copy,
|
|
requestOptions(cloud, "storage", {
|
|
signal,
|
|
body: { srcKey, destKey, ...(destResourceId ? { destResourceId } : {}) },
|
|
}),
|
|
storagePathParams(cloud, srcResourceId),
|
|
);
|
|
}
|
|
|
|
export async function listCosmosContainers(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CosmosContainer[]> {
|
|
const res = await apiClient.call<CosmosContainer[]>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.containers.list,
|
|
requestOptions(cloud, "nosql", { signal }),
|
|
databasePathParams(cloud, databaseId),
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createCosmosContainer(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
values: Record<string, unknown>,
|
|
signal?: AbortSignal,
|
|
): Promise<CosmosContainer> {
|
|
const res = await apiClient.call<CosmosContainer, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.containers.create,
|
|
requestOptions(cloud, "nosql", { signal, body: values }),
|
|
databasePathParams(cloud, databaseId),
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteCosmosContainer(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
containerId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.containers.delete,
|
|
requestOptions(cloud, "nosql", { signal }),
|
|
{ ...databasePathParams(cloud, databaseId), containerId },
|
|
);
|
|
}
|
|
|
|
|
|
|
|
export async function listCosmosItems(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
containerId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CosmosItem[]> {
|
|
const res = await apiClient.call<CosmosItem[]>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.items.list,
|
|
requestOptions(cloud, "nosql", { signal }),
|
|
{ ...databasePathParams(cloud, databaseId), containerId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function upsertCosmosItem(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
containerId: string,
|
|
document: Record<string, unknown>,
|
|
signal?: AbortSignal,
|
|
): Promise<CosmosItem> {
|
|
const res = await apiClient.call<CosmosItem, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.items.upsert,
|
|
requestOptions(cloud, "nosql", { signal, body: document }),
|
|
{ ...databasePathParams(cloud, databaseId), containerId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteCosmosItem(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
containerId: string,
|
|
itemId: string,
|
|
partitionKey?: string | null,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.items.delete,
|
|
requestOptions(cloud, "nosql", {
|
|
signal,
|
|
params: partitionKey ? { partitionKey } : undefined,
|
|
}),
|
|
{ ...databasePathParams(cloud, databaseId), containerId, itemId },
|
|
);
|
|
}
|
|
|
|
export async function queryCosmosItems(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
containerId: string,
|
|
query: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CosmosQueryResult> {
|
|
const res = await apiClient.call<CosmosQueryResult, { query: string }>(
|
|
apiEndpointKeys.clouds.nosql.cosmos.items.query,
|
|
requestOptions(cloud, "nosql", { signal, body: { query } }),
|
|
{ ...databasePathParams(cloud, databaseId), containerId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listChildCollections(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
cursor?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CollectionPage<ChildCollection>> {
|
|
const res = await apiClient.call<CollectionPage<ChildCollection>>(
|
|
apiEndpointKeys.clouds.childCollections.list,
|
|
requestOptions(cloud, service, { signal, params: cursor ? { cursor } : undefined }),
|
|
{ cloud, service, id: resourceId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listCollectionItems(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
collectionId: string,
|
|
cursor?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CollectionPage<ChildItem>> {
|
|
const res = await apiClient.call<CollectionPage<ChildItem>>(
|
|
apiEndpointKeys.clouds.childCollections.items.list,
|
|
requestOptions(cloud, service, { signal, params: cursor ? { cursor } : undefined }),
|
|
{ cloud, service, id: resourceId, cid: collectionId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listFlatItems(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
cursor?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CollectionPage<ChildItem>> {
|
|
const res = await apiClient.call<CollectionPage<ChildItem>>(
|
|
apiEndpointKeys.clouds.flatItems.list,
|
|
requestOptions(cloud, service, { signal, params: cursor ? { cursor } : undefined }),
|
|
{ cloud, service, id: resourceId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function queryFlatItems(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
query: Record<string, unknown>,
|
|
cursor?: string,
|
|
limit = 100,
|
|
signal?: AbortSignal,
|
|
): Promise<CollectionPage<ChildItem>> {
|
|
const res = await apiClient.call<CollectionPage<ChildItem>, {query: Record<string, unknown>}>(
|
|
apiEndpointKeys.clouds.flatItems.query,
|
|
requestOptions(cloud, service, {signal, params: {cursor, limit}, body: {query}}),
|
|
{cloud, service, id: resourceId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteFlatItem(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
itemId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.flatItems.delete,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service, id: resourceId, itemId },
|
|
);
|
|
}
|
|
|
|
export async function getFlatItem(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
itemId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<ChildItem> {
|
|
const res = await apiClient.call<ChildItem>(
|
|
apiEndpointKeys.clouds.flatItems.get,
|
|
requestOptions(cloud, service, { signal }),
|
|
{ cloud, service, id: resourceId, itemId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function updateUserPoolUser(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
username: string,
|
|
input: UserPoolUserAction,
|
|
): Promise<void> {
|
|
await apiClient.call<void, UserPoolUserAction>(
|
|
apiEndpointKeys.clouds.userpools.userAction,
|
|
requestOptions(cloud, "userpools", { body: input }),
|
|
{ cloud, id: poolId, username },
|
|
);
|
|
}
|
|
|
|
export async function setUserPoolUserGroups(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
username: string,
|
|
groups: string[],
|
|
): Promise<void> {
|
|
await apiClient.call<void, { groups: string[] }>(
|
|
apiEndpointKeys.clouds.userpools.userGroups,
|
|
requestOptions(cloud, "userpools", { body: { groups } }),
|
|
{ cloud, id: poolId, username },
|
|
);
|
|
}
|
|
|
|
export async function listUserPoolGroups(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<UserPoolGroup[]> {
|
|
const res = await apiClient.call<UserPoolGroup[]>(
|
|
apiEndpointKeys.clouds.userpools.groups.list,
|
|
requestOptions(cloud, "userpools", { signal }),
|
|
{ cloud, id: poolId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createUserPoolGroup(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
input: CreateUserPoolGroupInput,
|
|
): Promise<UserPoolGroup> {
|
|
const res = await apiClient.call<UserPoolGroup, CreateUserPoolGroupInput>(
|
|
apiEndpointKeys.clouds.userpools.groups.create,
|
|
requestOptions(cloud, "userpools", { body: input }),
|
|
{ cloud, id: poolId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteUserPoolGroup(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
groupName: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.userpools.groups.delete,
|
|
requestOptions(cloud, "userpools"),
|
|
{ cloud, id: poolId, groupName },
|
|
);
|
|
}
|
|
|
|
export async function testUserPoolSignIn(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
input: UserPoolSignInTestInput,
|
|
): Promise<UserPoolSignInTestResult> {
|
|
const res = await apiClient.call<UserPoolSignInTestResult, UserPoolSignInTestInput>(
|
|
apiEndpointKeys.clouds.userpools.signInTest,
|
|
requestOptions(cloud, "userpools", { body: input }),
|
|
{ cloud, id: poolId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listMetrics(
|
|
cloud: CloudProvider,
|
|
query: { namespace?: string; search?: string } = {},
|
|
signal?: AbortSignal,
|
|
): Promise<MetricSummary[]> {
|
|
const res = await apiClient.call<MetricSummary[]>(
|
|
apiEndpointKeys.clouds.monitoring.metrics,
|
|
requestOptions(cloud, "monitoring", { signal, params: { namespace: query.namespace || undefined, search: query.search || undefined } }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getMetricSeries(
|
|
cloud: CloudProvider,
|
|
query: MetricSeriesQuery,
|
|
signal?: AbortSignal,
|
|
): Promise<MetricSeries> {
|
|
const res = await apiClient.call<MetricSeries, MetricSeriesQuery>(
|
|
apiEndpointKeys.clouds.monitoring.metricData,
|
|
requestOptions(cloud, "monitoring", { signal, body: query }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function describeAlarmHistory(
|
|
cloud: CloudProvider,
|
|
alarmName: string,
|
|
signal?: AbortSignal,
|
|
): Promise<AlarmHistoryItem[]> {
|
|
const res = await apiClient.call<AlarmHistoryItem[]>(
|
|
apiEndpointKeys.clouds.monitoring.history,
|
|
requestOptions(cloud, "monitoring", { signal }),
|
|
{ cloud, id: alarmName },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function setAlarmState(
|
|
cloud: CloudProvider,
|
|
alarmName: string,
|
|
state: AlarmStateValue,
|
|
reason: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void, { state: AlarmStateValue; reason: string }>(
|
|
apiEndpointKeys.clouds.monitoring.state,
|
|
requestOptions(cloud, "monitoring", { body: { state, reason } }),
|
|
{ cloud, id: alarmName },
|
|
);
|
|
}
|
|
|
|
export async function setAlarmActionsEnabled(
|
|
cloud: CloudProvider,
|
|
alarmName: string,
|
|
enabled: boolean,
|
|
): Promise<void> {
|
|
await apiClient.call<void, { enabled: boolean }>(
|
|
apiEndpointKeys.clouds.monitoring.actions,
|
|
requestOptions(cloud, "monitoring", { body: { enabled } }),
|
|
{ cloud, id: alarmName },
|
|
);
|
|
}
|
|
|
|
export type HttpApiProtocol = "HTTP" | "WEBSOCKET";
|
|
|
|
export interface HttpApiIntegrationOverview {
|
|
integrationId: string;
|
|
type: string;
|
|
uri: string | null;
|
|
functionName: string | null;
|
|
payloadFormatVersion: string | null;
|
|
}
|
|
|
|
export interface HttpApiRouteOverview {
|
|
routeId: string;
|
|
routeKey: string;
|
|
integration: HttpApiIntegrationOverview | null;
|
|
authorizationType: string;
|
|
authorizerId: string | null;
|
|
authorizationScopes: string[];
|
|
returnsResponse: boolean;
|
|
}
|
|
|
|
export interface HttpApiStageOverview {
|
|
stageName: string;
|
|
autoDeploy: boolean;
|
|
deploymentId: string | null;
|
|
lastUpdatedAt: string | null;
|
|
invokePath: string;
|
|
}
|
|
|
|
export interface HttpApiAuthorizerOverview {
|
|
authorizerId: string;
|
|
name: string;
|
|
type: string;
|
|
identitySource: string[];
|
|
issuer: string | null;
|
|
audience: string[];
|
|
}
|
|
|
|
export interface HttpApiCors {
|
|
allowOrigins: string[];
|
|
allowMethods: string[];
|
|
allowHeaders: string[];
|
|
exposeHeaders: string[];
|
|
maxAgeSeconds: number | null;
|
|
allowCredentials: boolean;
|
|
}
|
|
|
|
export interface HttpApiOverview {
|
|
apiId: string;
|
|
protocol: HttpApiProtocol;
|
|
apiEndpoint: string | null;
|
|
routeSelectionExpression: string | null;
|
|
routes: HttpApiRouteOverview[];
|
|
stages: HttpApiStageOverview[];
|
|
authorizers: HttpApiAuthorizerOverview[];
|
|
cors: HttpApiCors | null;
|
|
}
|
|
|
|
export interface HttpApiRouteInput {
|
|
routeKey: string;
|
|
functionName?: string;
|
|
httpUrl?: string;
|
|
authorizerId?: string;
|
|
returnsResponse?: boolean;
|
|
}
|
|
|
|
export interface HttpApiAuthorizerInput {
|
|
name: string;
|
|
userPoolId?: string;
|
|
userPoolClientId?: string;
|
|
issuer?: string;
|
|
audience?: string[];
|
|
}
|
|
|
|
export interface HttpApiWebSocketTestResult {
|
|
connected: boolean;
|
|
messages: string[];
|
|
closeCode: number | null;
|
|
error: string | null;
|
|
durationMs: number;
|
|
}
|
|
|
|
export async function describeHttpApi(cloud: CloudProvider, apiId: string, signal?: AbortSignal): Promise<HttpApiOverview> {
|
|
const res = await apiClient.call<HttpApiOverview>(apiEndpointKeys.clouds.httpApi.describe, requestOptions(cloud, "apigateway", { signal }), { cloud, id: apiId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function createHttpApiRoute(cloud: CloudProvider, apiId: string, input: HttpApiRouteInput): Promise<HttpApiRouteOverview> {
|
|
const res = await apiClient.call<HttpApiRouteOverview, HttpApiRouteInput>(apiEndpointKeys.clouds.httpApi.createRoute, requestOptions(cloud, "apigateway", { body: input }), { cloud, id: apiId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteHttpApiRoute(cloud: CloudProvider, apiId: string, routeId: string): Promise<void> {
|
|
await apiClient.call<void>(apiEndpointKeys.clouds.httpApi.deleteRoute, requestOptions(cloud, "apigateway"), { cloud, id: apiId, routeId });
|
|
}
|
|
|
|
export async function setHttpApiRouteAuthorizer(cloud: CloudProvider, apiId: string, routeId: string, authorizerId: string | null): Promise<HttpApiRouteOverview> {
|
|
const res = await apiClient.call<HttpApiRouteOverview, { authorizerId: string | null }>(apiEndpointKeys.clouds.httpApi.setRouteAuthorizer, requestOptions(cloud, "apigateway", { body: { authorizerId } }), { cloud, id: apiId, routeId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function createHttpApiStage(cloud: CloudProvider, apiId: string, input: { stageName: string; autoDeploy: boolean }): Promise<HttpApiStageOverview> {
|
|
const res = await apiClient.call<HttpApiStageOverview, typeof input>(apiEndpointKeys.clouds.httpApi.createStage, requestOptions(cloud, "apigateway", { body: input }), { cloud, id: apiId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteHttpApiStage(cloud: CloudProvider, apiId: string, stageName: string): Promise<void> {
|
|
await apiClient.call<void>(apiEndpointKeys.clouds.httpApi.deleteStage, requestOptions(cloud, "apigateway"), { cloud, id: apiId, stageName });
|
|
}
|
|
|
|
export async function deployHttpApi(cloud: CloudProvider, apiId: string, stageName: string): Promise<HttpApiStageOverview> {
|
|
const res = await apiClient.call<HttpApiStageOverview>(apiEndpointKeys.clouds.httpApi.deploy, requestOptions(cloud, "apigateway"), { cloud, id: apiId, stageName });
|
|
return res.data;
|
|
}
|
|
|
|
export async function createHttpApiAuthorizer(cloud: CloudProvider, apiId: string, input: HttpApiAuthorizerInput): Promise<HttpApiAuthorizerOverview> {
|
|
const res = await apiClient.call<HttpApiAuthorizerOverview, HttpApiAuthorizerInput>(apiEndpointKeys.clouds.httpApi.createAuthorizer, requestOptions(cloud, "apigateway", { body: input }), { cloud, id: apiId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteHttpApiAuthorizer(cloud: CloudProvider, apiId: string, authorizerId: string): Promise<void> {
|
|
await apiClient.call<void>(apiEndpointKeys.clouds.httpApi.deleteAuthorizer, requestOptions(cloud, "apigateway"), { cloud, id: apiId, authorizerId });
|
|
}
|
|
|
|
export async function updateHttpApiCors(cloud: CloudProvider, apiId: string, cors: HttpApiCors | null): Promise<HttpApiCors | null> {
|
|
const res = await apiClient.call<{ cors: HttpApiCors | null }, { cors: HttpApiCors | null }>(apiEndpointKeys.clouds.httpApi.cors, requestOptions(cloud, "apigateway", { body: { cors } }), { cloud, id: apiId });
|
|
return res.data.cors;
|
|
}
|
|
|
|
export async function testWebSocketApi(cloud: CloudProvider, apiId: string, input: { stage: string; message: string; query?: string }): Promise<HttpApiWebSocketTestResult> {
|
|
const res = await apiClient.call<HttpApiWebSocketTestResult, typeof input>(apiEndpointKeys.clouds.httpApi.webSocketTest, requestOptions(cloud, "apigateway", { body: input }), { cloud, id: apiId });
|
|
return res.data;
|
|
}
|
|
|
|
export async function getCertificatePem(
|
|
cloud: CloudProvider,
|
|
certificateId: string,
|
|
): Promise<CertificatePem> {
|
|
const res = await apiClient.call<CertificatePem>(
|
|
apiEndpointKeys.clouds.certificates.pem,
|
|
requestOptions(cloud, "certificates"),
|
|
{ cloud, id: certificateId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function exportCertificate(
|
|
cloud: CloudProvider,
|
|
certificateId: string,
|
|
passphrase: string,
|
|
): Promise<ExportedCertificate> {
|
|
const res = await apiClient.call<ExportedCertificate, { passphrase: string }>(
|
|
apiEndpointKeys.clouds.certificates.export,
|
|
requestOptions(cloud, "certificates", { body: { passphrase } }),
|
|
{ cloud, id: certificateId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function revokeCertificate(
|
|
cloud: CloudProvider,
|
|
certificateId: string,
|
|
reason: CertificateRevocationReason,
|
|
): Promise<CloudResource> {
|
|
const res = await apiClient.call<CloudResource, { reason: CertificateRevocationReason }>(
|
|
apiEndpointKeys.clouds.certificates.revoke,
|
|
requestOptions(cloud, "certificates", { body: { reason } }),
|
|
{ cloud, id: certificateId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function setDistributionEnabled(
|
|
cloud: CloudProvider,
|
|
distributionId: string,
|
|
enabled: boolean,
|
|
): Promise<CloudResource> {
|
|
const res = await apiClient.call<CloudResource, { enabled: boolean }>(
|
|
apiEndpointKeys.clouds.cdn.enabled,
|
|
requestOptions(cloud, "cdn", { body: { enabled } }),
|
|
{ cloud, id: distributionId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createDistributionInvalidation(
|
|
cloud: CloudProvider,
|
|
distributionId: string,
|
|
paths: string[],
|
|
): Promise<DistributionInvalidation> {
|
|
const res = await apiClient.call<DistributionInvalidation, { paths: string[] }>(
|
|
apiEndpointKeys.clouds.cdn.invalidations,
|
|
requestOptions(cloud, "cdn", { body: { paths } }),
|
|
{ cloud, id: distributionId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function describeUserPoolClient(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
clientId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<UserPoolClientSettings> {
|
|
const res = await apiClient.call<UserPoolClientSettings>(
|
|
apiEndpointKeys.clouds.userpools.client.get,
|
|
requestOptions(cloud, "userpools", { signal }),
|
|
{ cloud, id: poolId, clientId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function updateUserPoolClientOAuth(
|
|
cloud: CloudProvider,
|
|
poolId: string,
|
|
clientId: string,
|
|
input: UpdateUserPoolClientOAuthInput,
|
|
): Promise<UserPoolClientSettings> {
|
|
const res = await apiClient.call<UserPoolClientSettings, UpdateUserPoolClientOAuthInput>(
|
|
apiEndpointKeys.clouds.userpools.client.updateOAuth,
|
|
requestOptions(cloud, "userpools", { body: input }),
|
|
{ cloud, id: poolId, clientId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function putFlatItem(
|
|
cloud: CloudProvider,
|
|
service: CloudServiceType,
|
|
resourceId: string,
|
|
body: Record<string, unknown>,
|
|
): Promise<ChildItem> {
|
|
const res = await apiClient.call<ChildItem, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.flatItems.create,
|
|
requestOptions(cloud, service, {body}),
|
|
{cloud, service, id: resourceId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listSqlDatabases(
|
|
cloud: CloudProvider,
|
|
serverId: string,
|
|
engine: SqlEngine,
|
|
credentials: SqlCredentials,
|
|
signal?: AbortSignal,
|
|
): Promise<SqlDatabase[]> {
|
|
const res = await apiClient.call<SqlDatabase[], SqlCredentials & { engine: SqlEngine }>(
|
|
apiEndpointKeys.clouds.database.sql.databases,
|
|
requestOptions(cloud, "database", {
|
|
signal,
|
|
body: { ...credentials, engine },
|
|
timeout: SQL_DATA_TIMEOUT_MS,
|
|
}),
|
|
{ cloud, id: serverId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listSqlTables(
|
|
cloud: CloudProvider,
|
|
serverId: string,
|
|
engine: SqlEngine,
|
|
database: string,
|
|
credentials: SqlCredentials,
|
|
signal?: AbortSignal,
|
|
): Promise<SqlTable[]> {
|
|
const res = await apiClient.call<
|
|
SqlTable[],
|
|
SqlCredentials & { database: string; engine: SqlEngine }
|
|
>(
|
|
apiEndpointKeys.clouds.database.sql.tables,
|
|
requestOptions(cloud, "database", {
|
|
signal,
|
|
body: { ...credentials, database, engine },
|
|
timeout: SQL_DATA_TIMEOUT_MS,
|
|
}),
|
|
{ cloud, id: serverId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function querySql(
|
|
cloud: CloudProvider,
|
|
serverId: string,
|
|
engine: SqlEngine,
|
|
database: string,
|
|
credentials: SqlCredentials,
|
|
query: string,
|
|
signal?: AbortSignal,
|
|
): Promise<SqlQueryResult> {
|
|
const res = await apiClient.call<
|
|
SqlQueryResult,
|
|
SqlCredentials & { database: string; engine: SqlEngine; query: string }
|
|
>(
|
|
apiEndpointKeys.clouds.database.sql.query,
|
|
requestOptions(cloud, "database", {
|
|
signal,
|
|
body: { ...credentials, database, engine, query },
|
|
timeout: SQL_DATA_TIMEOUT_MS,
|
|
}),
|
|
{ cloud, id: serverId },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function queryLogs(
|
|
cloud: CloudProvider,
|
|
logGroupName: string,
|
|
input: LogsInsightsQueryInput,
|
|
signal?: AbortSignal,
|
|
): Promise<LogsInsightsQueryResult> {
|
|
const res = await apiClient.call<LogsInsightsQueryResult, LogsInsightsQueryInput>(
|
|
apiEndpointKeys.clouds.logs.query,
|
|
requestOptions(cloud, "logs", { signal, body: input, timeout: LOGS_QUERY_TIMEOUT_MS }),
|
|
{ cloud, id: logGroupName },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function filterLogEvents(
|
|
cloud: CloudProvider,
|
|
logGroupName: string,
|
|
input: LogsFilterInput,
|
|
cursor?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<CollectionPage<ChildItem>> {
|
|
const res = await apiClient.call<CollectionPage<ChildItem>, LogsFilterInput>(
|
|
apiEndpointKeys.clouds.logs.filter,
|
|
requestOptions(cloud, "logs", { signal, body: input, params: cursor ? { cursor } : undefined }),
|
|
{ cloud, id: logGroupName },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function sendSqsMessage(cloud: CloudProvider, queueId: string, input: SqsSendMessageInput): Promise<{messageId: string}> {
|
|
const res = await apiClient.call<{messageId: string}, SqsSendMessageInput>(apiEndpointKeys.clouds.messaging.messages.send, requestOptions(cloud, 'messaging', {body: input}), {cloud, id: queueId})
|
|
return res.data
|
|
}
|
|
|
|
export async function receiveSqsMessages(cloud: CloudProvider, queueId: string, maxNumberOfMessages: number): Promise<SqsMessage[]> {
|
|
const res = await apiClient.call<SqsMessage[], {maxNumberOfMessages: number}>(apiEndpointKeys.clouds.messaging.messages.receive, requestOptions(cloud, 'messaging', {body: {maxNumberOfMessages}}), {cloud, id: queueId})
|
|
return res.data
|
|
}
|
|
|
|
export async function deleteSqsMessage(cloud: CloudProvider, queueId: string, receiptHandle: string): Promise<void> {
|
|
await apiClient.call(apiEndpointKeys.clouds.messaging.messages.delete, requestOptions(cloud, 'messaging', {body: {receiptHandle}}), {cloud, id: queueId})
|
|
}
|
|
|
|
export async function purgeSqsQueue(cloud: CloudProvider, queueId: string): Promise<void> {
|
|
await apiClient.call(apiEndpointKeys.clouds.messaging.messages.purge, requestOptions(cloud, 'messaging'), {cloud, id: queueId})
|
|
}
|
|
|
|
export async function startSqsMoveTask(cloud: CloudProvider, queueId: string, destinationArn?: string): Promise<{taskHandle: string}> {
|
|
const res = await apiClient.call<{taskHandle: string}, {destinationArn?: string}>(apiEndpointKeys.clouds.messaging.moveTasks, requestOptions(cloud, 'messaging', {body: {destinationArn}}), {cloud, id: queueId})
|
|
return res.data
|
|
}
|
|
|
|
export async function listDatabaseSnapshots(
|
|
cloud: CloudProvider,
|
|
instanceIdentifier?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<DatabaseSnapshot[]> {
|
|
const res = await apiClient.call<DatabaseSnapshot[]>(
|
|
apiEndpointKeys.clouds.database.snapshots.list,
|
|
requestOptions(cloud, "database", {
|
|
signal,
|
|
params: instanceIdentifier ? { instanceIdentifier } : undefined,
|
|
}),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createDatabaseSnapshot(
|
|
cloud: CloudProvider,
|
|
input: CreateDatabaseSnapshotInput,
|
|
signal?: AbortSignal,
|
|
): Promise<DatabaseSnapshot> {
|
|
const res = await apiClient.call<DatabaseSnapshot, CreateDatabaseSnapshotInput>(
|
|
apiEndpointKeys.clouds.database.snapshots.create,
|
|
requestOptions(cloud, "database", { signal, body: input }),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listDatabaseOrderableClasses(
|
|
cloud: CloudProvider,
|
|
engine?: string,
|
|
signal?: AbortSignal,
|
|
): Promise<string[]> {
|
|
const res = await apiClient.call<string[]>(
|
|
apiEndpointKeys.clouds.database.orderableClasses.list,
|
|
requestOptions(cloud, "database", {
|
|
signal,
|
|
params: engine ? { engine } : undefined,
|
|
}),
|
|
{ cloud },
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listKubernetesNodegroups(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<KubernetesNodegroup[]> {
|
|
const res = await apiClient.call<KubernetesNodegroup[]>(
|
|
apiEndpointKeys.clouds.k8s.nodegroups.list,
|
|
requestOptions(cloud, "k8s", {signal}),
|
|
{cloud, id: clusterId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export async function createKubernetesNodegroup(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
input: CreateKubernetesNodegroupInput,
|
|
): Promise<KubernetesNodegroup> {
|
|
const res = await apiClient.call<KubernetesNodegroup, CreateKubernetesNodegroupInput>(
|
|
apiEndpointKeys.clouds.k8s.nodegroups.create,
|
|
requestOptions(cloud, "k8s", {body: input}),
|
|
{cloud, id: clusterId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export async function deleteKubernetesNodegroup(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
nodegroupId: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.k8s.nodegroups.delete,
|
|
requestOptions(cloud, "k8s"),
|
|
{cloud, id: clusterId, nodegroupId},
|
|
)
|
|
}
|
|
|
|
export async function listKubernetesFargateProfiles(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<KubernetesFargateProfile[]> {
|
|
const res = await apiClient.call<KubernetesFargateProfile[]>(
|
|
apiEndpointKeys.clouds.k8s.fargateProfiles.list,
|
|
requestOptions(cloud, "k8s", {signal}),
|
|
{cloud, id: clusterId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export async function createKubernetesFargateProfile(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
input: CreateKubernetesFargateProfileInput,
|
|
): Promise<KubernetesFargateProfile> {
|
|
const res = await apiClient.call<KubernetesFargateProfile, CreateKubernetesFargateProfileInput>(
|
|
apiEndpointKeys.clouds.k8s.fargateProfiles.create,
|
|
requestOptions(cloud, "k8s", {body: input}),
|
|
{cloud, id: clusterId},
|
|
)
|
|
return res.data
|
|
}
|
|
|
|
export async function deleteKubernetesFargateProfile(
|
|
cloud: CloudProvider,
|
|
clusterId: string,
|
|
profileId: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.k8s.fargateProfiles.delete,
|
|
requestOptions(cloud, "k8s"),
|
|
{cloud, id: clusterId, profileId},
|
|
)
|
|
}
|
|
|
|
export async function listAppConfigEnvironments(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigEnvironment[]> {
|
|
const res = await apiClient.call<AppConfigEnvironment[]>(
|
|
apiEndpointKeys.clouds.configuration.environments.list,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud, id: applicationId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createAppConfigEnvironment(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
values: Record<string, unknown>,
|
|
): Promise<AppConfigEnvironment> {
|
|
const res = await apiClient.call<AppConfigEnvironment, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.configuration.environments.create,
|
|
requestOptions(cloud, "configuration", {body: values}),
|
|
{cloud, id: applicationId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteAppConfigEnvironment(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
environmentId: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.configuration.environments.delete,
|
|
requestOptions(cloud, "configuration"),
|
|
{cloud, id: applicationId, environmentId},
|
|
);
|
|
}
|
|
|
|
export async function listAppConfigConfigurationProfiles(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigConfigurationProfile[]> {
|
|
const res = await apiClient.call<AppConfigConfigurationProfile[]>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.list,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud, id: applicationId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createAppConfigConfigurationProfile(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
values: Record<string, unknown>,
|
|
): Promise<AppConfigConfigurationProfile> {
|
|
const res = await apiClient.call<AppConfigConfigurationProfile, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.create,
|
|
requestOptions(cloud, "configuration", {body: values}),
|
|
{cloud, id: applicationId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteAppConfigConfigurationProfile(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
profileId: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.delete,
|
|
requestOptions(cloud, "configuration"),
|
|
{cloud, id: applicationId, profileId},
|
|
);
|
|
}
|
|
|
|
export async function listAppConfigHostedConfigurationVersions(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
profileId: string,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigHostedConfigurationVersion[]> {
|
|
const res = await apiClient.call<AppConfigHostedConfigurationVersion[]>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.hostedVersions.list,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud, id: applicationId, profileId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getAppConfigHostedConfigurationVersion(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
profileId: string,
|
|
versionNumber: number,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigHostedConfigurationVersion> {
|
|
const res = await apiClient.call<AppConfigHostedConfigurationVersion>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.hostedVersions.get,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud, id: applicationId, profileId, versionNumber: String(versionNumber)},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createAppConfigHostedConfigurationVersion(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
profileId: string,
|
|
values: Record<string, unknown>,
|
|
): Promise<AppConfigHostedConfigurationVersion> {
|
|
const res = await apiClient.call<AppConfigHostedConfigurationVersion, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.hostedVersions.create,
|
|
requestOptions(cloud, "configuration", {body: values}),
|
|
{cloud, id: applicationId, profileId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteAppConfigHostedConfigurationVersion(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
profileId: string,
|
|
versionNumber: number,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.configuration.configurationProfiles.hostedVersions.delete,
|
|
requestOptions(cloud, "configuration"),
|
|
{cloud, id: applicationId, profileId, versionNumber: String(versionNumber)},
|
|
);
|
|
}
|
|
|
|
export async function listAppConfigDeploymentStrategies(
|
|
cloud: CloudProvider,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigDeploymentStrategy[]> {
|
|
const res = await apiClient.call<AppConfigDeploymentStrategy[]>(
|
|
apiEndpointKeys.clouds.configuration.deploymentStrategies.list,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createAppConfigDeploymentStrategy(
|
|
cloud: CloudProvider,
|
|
values: Record<string, unknown>,
|
|
): Promise<AppConfigDeploymentStrategy> {
|
|
const res = await apiClient.call<AppConfigDeploymentStrategy, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.configuration.deploymentStrategies.create,
|
|
requestOptions(cloud, "configuration", {body: values}),
|
|
{cloud},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteAppConfigDeploymentStrategy(
|
|
cloud: CloudProvider,
|
|
strategyId: string,
|
|
): Promise<void> {
|
|
await apiClient.call<void>(
|
|
apiEndpointKeys.clouds.configuration.deploymentStrategies.delete,
|
|
requestOptions(cloud, "configuration"),
|
|
{cloud, strategyId},
|
|
);
|
|
}
|
|
|
|
export async function startAppConfigDeployment(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
environmentId: string,
|
|
values: Record<string, unknown>,
|
|
): Promise<AppConfigDeployment> {
|
|
const res = await apiClient.call<AppConfigDeployment, Record<string, unknown>>(
|
|
apiEndpointKeys.clouds.configuration.environments.deployments.start,
|
|
requestOptions(cloud, "configuration", {body: values}),
|
|
{cloud, id: applicationId, environmentId},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
export async function getAppConfigDeployment(
|
|
cloud: CloudProvider,
|
|
applicationId: string,
|
|
environmentId: string,
|
|
deploymentNumber: number,
|
|
signal?: AbortSignal,
|
|
): Promise<AppConfigDeployment> {
|
|
const res = await apiClient.call<AppConfigDeployment>(
|
|
apiEndpointKeys.clouds.configuration.environments.deployments.get,
|
|
requestOptions(cloud, "configuration", {signal}),
|
|
{cloud, id: applicationId, environmentId, deploymentNumber: String(deploymentNumber)},
|
|
);
|
|
return res.data;
|
|
}
|
|
|
|
function requestOptions<TBody = unknown>(
|
|
_cloud: CloudProvider,
|
|
_service: string,
|
|
options: {
|
|
signal?: AbortSignal;
|
|
params?: Record<string, string | number | boolean | undefined>;
|
|
body?: TBody;
|
|
rawBody?: BodyInit;
|
|
headers?: HeadersInit;
|
|
/** Overrides the client default; needed for calls that can legitimately run long. */
|
|
timeout?: number;
|
|
} = {},
|
|
) {
|
|
return {
|
|
...options,
|
|
};
|
|
}
|
|
|
|
function storagePathParams(
|
|
cloud: CloudProvider,
|
|
resourceId: string,
|
|
): CloudPathParams {
|
|
return { cloud, id: resourceId };
|
|
}
|
|
|
|
function databasePathParams(
|
|
cloud: CloudProvider,
|
|
databaseId: string,
|
|
): CloudPathParams {
|
|
return { cloud, id: databaseId };
|
|
}
|