finops-mcp-server
Version:
MCP server for FinOps Center cost optimization integration
269 lines • 6.99 kB
TypeScript
/**
* FinOps Center API Type Definitions
*
* This file contains TypeScript type definitions for FinOps Center API requests and responses,
* including cost optimization parameters, GraphQL schema mappings, and response types.
*/
export type CostOptimizationActionType = "approve" | "ignore" | "complete";
export interface APIResponse<T = any> {
data?: T;
error?: APIError;
summary?: any;
}
export interface APIError {
message: string;
code: string;
details?: any;
}
export interface GraphQLResponse<T = any> {
data?: T;
errors?: GraphQLError[];
}
export interface GraphQLError {
message: string;
locations?: Array<{
line: number;
column: number;
}>;
path?: Array<string | number>;
extensions?: {
code?: string;
[key: string]: any;
};
}
export interface CostOptimizationParams {
account?: string;
element?: string;
recommendation_type?: string;
status?: string;
priority?: string;
category?: string;
limit?: number;
}
export interface CostTrendParams {
element?: string;
account?: string;
start_date?: string;
end_date?: string;
trend_type?: string;
status?: string;
limit?: number;
nextToken?: string;
}
export interface CostOptimizationInput {
recommendation_id: string;
action_type: CostOptimizationActionType;
}
export interface CostOptimizationRecommendation {
recommendation_id: string;
element?: string;
account?: string;
recommendation_type?: string;
status?: string;
potential_savings?: number;
description?: string;
created_date?: string;
priority?: string;
category?: string;
resource_id?: string;
region?: string;
service?: string;
last_action_user?: string;
last_action_role?: string;
updated_date?: string;
}
export interface CostOptimizationSummary {
total_recommendations: number;
total_potential_savings: number;
average_savings_per_recommendation: number;
status_breakdown: StatusBreakdown[];
category_breakdown: CategoryBreakdown[];
priority_breakdown: PriorityBreakdown[];
}
export interface StatusBreakdown {
status: string;
count: number;
total_savings: number;
}
export interface CategoryBreakdown {
category: string;
count: number;
total_savings: number;
}
export interface PriorityBreakdown {
priority: string;
count: number;
total_savings: number;
}
export interface CostOptimizationResponse {
data: CostOptimizationRecommendation[];
summary?: CostOptimizationSummary;
error?: {
details?: string;
message: string;
code: string;
};
}
export interface CostOptimizationCreateResponse {
data: CostOptimizationRecommendation;
error?: {
details?: string;
message: string;
code: string;
};
}
export interface CostTrend {
recommendation_id: string;
element?: string;
account?: string;
trend_type?: string;
status?: string;
potential_savings?: number;
actual_savings?: number;
created_date?: string;
implemented_date?: string;
roi_percentage?: number;
implementation_cost?: number;
}
export interface TrendTypeBreakdown {
trend_type: string;
count: number;
total_savings: number;
}
export interface CostTrendSummary {
total_recommendations: number;
total_potential_savings: number;
total_actual_savings: number;
average_roi_percentage: number;
total_projected_savings: number;
status_breakdown: StatusBreakdown[];
trend_type_breakdown: TrendTypeBreakdown[];
}
export interface CostTrendsResponse {
data: CostTrend[];
summary?: CostTrendSummary;
nextToken?: string;
error?: {
details?: string;
message: string;
code: string;
};
}
export interface GraphQLQuery {
query: string;
variables?: Record<string, any>;
operationName?: string;
}
export interface GraphQLMutation {
mutation: string;
variables?: Record<string, any>;
operationName?: string;
}
export interface APIClient {
getCostOptimizationRecommendations(params: CostOptimizationParams): Promise<CostOptimizationResponse>;
analyzeCostTrends(params: CostTrendParams): Promise<CostTrendsResponse>;
processCostOptimizationRecommendation(input: CostOptimizationInput): Promise<CostOptimizationCreateResponse>;
}
export interface HTTPClientConfig {
baseURL: string;
timeout?: number;
retryAttempts?: number;
retryDelay?: number;
headers?: Record<string, string>;
}
export interface AuthenticationConfig {
type: "bearer" | "api-key" | "custom";
token?: string;
apiKey?: string;
customHeader?: string;
}
export interface RequestInterceptor {
(config: HTTPRequestConfig): HTTPRequestConfig | Promise<HTTPRequestConfig>;
}
export interface ResponseInterceptor {
(response: HTTPResponse): HTTPResponse | Promise<HTTPResponse>;
}
export interface HTTPRequestConfig {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
headers?: Record<string, string>;
data?: any;
params?: Record<string, any>;
timeout?: number;
}
export interface HTTPResponse<T = any> {
data: T;
status: number;
statusText: string;
headers: Record<string, string>;
config: HTTPRequestConfig;
}
export interface NetworkError extends Error {
code?: string;
config?: HTTPRequestConfig;
request?: any;
response?: HTTPResponse;
}
export interface APIClientError extends Error {
code: string;
statusCode?: number;
response?: HTTPResponse;
originalError?: Error;
}
export interface RateLimitInfo {
limit: number;
remaining: number;
reset: number;
retryAfter?: number;
}
export interface RateLimitError extends APIClientError {
rateLimitInfo: RateLimitInfo;
}
export interface PaginatedRequest {
limit?: number;
nextToken?: string;
}
export interface PaginatedResponse<T = any> {
data: T[];
nextToken?: string;
hasMore?: boolean;
totalCount?: number;
}
export interface ValidationError extends APIError {
field?: string;
value?: any;
constraint?: string;
}
export interface ValidationResult {
isValid: boolean;
errors: ValidationError[];
}
export interface APIRequestLog {
timestamp: string;
method: string;
url: string;
headers: Record<string, string>;
body?: any;
correlationId?: string;
}
export interface APIResponseLog {
timestamp: string;
status: number;
statusText: string;
headers: Record<string, string>;
body?: any;
duration: number;
correlationId?: string;
}
export interface HealthCheckResponse {
status: "healthy" | "unhealthy" | "degraded";
timestamp: string;
version?: string;
uptime?: number;
checks?: Record<string, {
status: "pass" | "fail" | "warn";
message?: string;
duration?: number;
}>;
}
//# sourceMappingURL=api.d.ts.map