Edits history of script submission #18127 for ' Create a cluster (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Create a cluster
     *
     */
    export async function main(auth: RT.Qovery, organizationId: string, body: Body) {
    	const url = new URL(`https://api.qovery.com/organization/${organizationId}/cluster`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Token ' + auth.apiKey
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    export type CpuArchitectureEnum = 'AMD64' | 'ARM64'
    export type KarpenterNodePoolRequirementKey =
    	| 'InstanceFamily'
    	| 'InstanceSize'
    	| 'Arch'
    	| 'SkuFamily'
    	| 'SkuVersion'
    export type KarpenterNodePoolRequirementOperator = 'In'
    export type KarpenterNodePoolRequirementKey1 =
    	| 'InstanceFamily'
    	| 'InstanceSize'
    	| 'Arch'
    	| 'SkuFamily'
    	| 'SkuVersion'
    export type KarpenterNodePoolRequirementOperator1 = 'In'
    
    export interface Body {
    	/**
    	 * name is case-insensitive
    	 */
    	name: string
    	description?: string
    	region: string
    	cloud_provider:
    		| 'AWS'
    		| 'SCW'
    		| 'GCP'
    		| 'DO'
    		| 'AZURE'
    		| 'OVH'
    		| 'CIVO'
    		| 'HETZNER'
    		| 'ORACLE'
    		| 'IBM'
    		| 'ON_PREMISE'
    	cloud_provider_credentials?: {
    		cloud_provider?: 'AWS' | 'SCW' | 'GCP' | 'ON_PREMISE' | 'AZURE'
    		credentials?: {
    			id?: string
    			name?: string
    			[k: string]: unknown
    		}
    		region?: string
    		[k: string]: unknown
    	}
    	min_running_nodes?: number
    	max_running_nodes?: number
    	/**
    	 * Unit is in GB. The disk size to be used for the node configuration
    	 */
    	disk_size?: number
    	/**
    	 * the instance type to be used for this cluster. The list of values can be retrieved via the endpoint /{CloudProvider}/instanceType
    	 */
    	instance_type?: string
    	kubernetes?: 'MANAGED' | 'SELF_MANAGED' | 'PARTIALLY_MANAGED'
    	/**
    	 * specific flag to indicate that this cluster is a production one
    	 */
    	production?: boolean
    	/**
    	 * Indicate your public ssh_key to remotely connect to your EC2 instance.
    	 */
    	ssh_keys?: string[]
    	features?: {
    		id?: string
    		value?:
    			| string
    			| boolean
    			| {
    					aws_vpc_eks_id: string
    					eks_subnets_zone_a_ids: string[]
    					eks_subnets_zone_b_ids: string[]
    					eks_subnets_zone_c_ids: string[]
    					documentdb_subnets_zone_a_ids?: string[]
    					documentdb_subnets_zone_b_ids?: string[]
    					documentdb_subnets_zone_c_ids?: string[]
    					elasticache_subnets_zone_a_ids?: string[]
    					elasticache_subnets_zone_b_ids?: string[]
    					elasticache_subnets_zone_c_ids?: string[]
    					rds_subnets_zone_a_ids?: string[]
    					rds_subnets_zone_b_ids?: string[]
    					rds_subnets_zone_c_ids?: string[]
    					eks_karpenter_fargate_subnets_zone_a_ids?: string[]
    					eks_karpenter_fargate_subnets_zone_b_ids?: string[]
    					eks_karpenter_fargate_subnets_zone_c_ids?: string[]
    					[k: string]: unknown
    			  }
    			| {
    					vpc_name: string
    					vpc_project_id?: string
    					subnetwork_name?: string
    					ip_range_services_name?: string
    					ip_range_pods_name?: string
    					additional_ip_range_pods_names?: string[]
    					[k: string]: unknown
    			  }
    			| ClusterFeatureKarpenterParameters
    		[k: string]: unknown
    	}[]
    	metrics_parameters?: MetricsParameters
    	infrastructure_charts_parameters?: {
    		nginx_parameters?: ClusterInfrastructureNginxChartParameters
    		cert_manager_parameters?: InfrastructureCertManagerChartParameters
    		metal_lb_parameters?: InfrastructureMetalLbChartParameters
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    export interface ClusterFeatureKarpenterParameters {
    	spot_enabled: boolean
    	disk_size_in_gib: number
    	default_service_architecture: CpuArchitectureEnum
    	qovery_node_pools: KarpenterNodePool
    	[k: string]: unknown
    }
    export interface KarpenterNodePool {
    	requirements: KarpenterNodePoolRequirement[]
    	stable_override?: KarpenterStableNodePoolOverride
    	default_override?: KarpenterDefaultNodePoolOverride
    	gpu_override?: KarpenterGpuNodePoolOverride
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolRequirement {
    	key: KarpenterNodePoolRequirementKey
    	operator: KarpenterNodePoolRequirementOperator
    	values: string[]
    	[k: string]: unknown
    }
    export interface KarpenterStableNodePoolOverride {
    	consolidation?: KarpenterNodePoolConsolidation
    	limits?: KarpenterNodePoolLimits
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolConsolidation {
    	enabled: boolean
    	days: ('MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY')[]
    	/**
    	 * The start date of the consolidation.
    	 * The format should follow ISO-8601 convention: "PThh:mm"
    	 *
    	 */
    	start_time: string
    	/**
    	 * The duration during the consolidation will be active.
    	 * The format should follow ISO-8601 convention: "PThhHmmM"
    	 *
    	 */
    	duration: string
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolLimits {
    	enabled: boolean
    	/**
    	 * CPU limit that will be applied for the node pool (in vCPU unit: 1 vCPU = 1000 millicores)
    	 */
    	max_cpu_in_vcpu: number
    	/**
    	 * Memory limit that will be applied for the node pool (in Gibibytes unit: 1Gi = 1024 mebibytes)
    	 */
    	max_memory_in_gibibytes: number
    	/**
    	 * GPU limit that will be applied for the node pool
    	 */
    	max_gpu: number
    	[k: string]: unknown
    }
    export interface KarpenterDefaultNodePoolOverride {
    	limits?: KarpenterNodePoolLimits1
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolLimits1 {
    	enabled: boolean
    	/**
    	 * CPU limit that will be applied for the node pool (in vCPU unit: 1 vCPU = 1000 millicores)
    	 */
    	max_cpu_in_vcpu: number
    	/**
    	 * Memory limit that will be applied for the node pool (in Gibibytes unit: 1Gi = 1024 mebibytes)
    	 */
    	max_memory_in_gibibytes: number
    	/**
    	 * GPU limit that will be applied for the node pool
    	 */
    	max_gpu: number
    	[k: string]: unknown
    }
    export interface KarpenterGpuNodePoolOverride {
    	consolidation?: KarpenterNodePoolConsolidation1
    	limits?: KarpenterNodePoolLimits2
    	requirements?: KarpenterNodePoolRequirement1[]
    	disk_size_in_gib?: number
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolConsolidation1 {
    	enabled: boolean
    	days: ('MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY')[]
    	/**
    	 * The start date of the consolidation.
    	 * The format should follow ISO-8601 convention: "PThh:mm"
    	 *
    	 */
    	start_time: string
    	/**
    	 * The duration during the consolidation will be active.
    	 * The format should follow ISO-8601 convention: "PThhHmmM"
    	 *
    	 */
    	duration: string
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolLimits2 {
    	enabled: boolean
    	/**
    	 * CPU limit that will be applied for the node pool (in vCPU unit: 1 vCPU = 1000 millicores)
    	 */
    	max_cpu_in_vcpu: number
    	/**
    	 * Memory limit that will be applied for the node pool (in Gibibytes unit: 1Gi = 1024 mebibytes)
    	 */
    	max_memory_in_gibibytes: number
    	/**
    	 * GPU limit that will be applied for the node pool
    	 */
    	max_gpu: number
    	[k: string]: unknown
    }
    export interface KarpenterNodePoolRequirement1 {
    	key: KarpenterNodePoolRequirementKey1
    	operator: KarpenterNodePoolRequirementOperator1
    	values: string[]
    	[k: string]: unknown
    }
    export interface MetricsParameters {
    	enabled?: boolean
    	configuration?: MetricsConfigurationManagedByQovery
    	[k: string]: unknown
    }
    export interface MetricsConfigurationManagedByQovery {
    	kind?: 'MANAGED_BY_QOVERY'
    	[k: string]: unknown
    }
    export interface ClusterInfrastructureNginxChartParameters {
    	replica_count?: number
    	default_ssl_certificate?: string
    	publish_status_address?: string
    	annotation_metal_lb_load_balancer_ips?: string
    	annotation_external_dns_kubernetes_target?: string
    	[k: string]: unknown
    }
    export interface InfrastructureCertManagerChartParameters {
    	kubernetes_namespace?: string
    	[k: string]: unknown
    }
    export interface InfrastructureMetalLbChartParameters {
    	ip_address_pools?: string[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago