MCPcopy Create free account
hub / github.com/Qovery/engine / new

Method new

lib-engine/src/environment/models/application.rs:92–183  ·  view source on GitHub ↗
(
        context: &Context,
        long_id: Uuid,
        action: Action,
        name: &str,
        kube_name: String,
        public_domain: String,
        ports: Vec<Port>,
        min_instance

Source from the content-addressed store, hash-verified

90impl<T: CloudProvider> Application<T> {
91 #[allow(clippy::too_many_arguments)]
92 pub fn new(
93 context: &Context,
94 long_id: Uuid,
95 action: Action,
96 name: &str,
97 kube_name: String,
98 public_domain: String,
99 ports: Vec<Port>,
100 min_instances: u32,
101 max_instances: u32,
102 build: Build,
103 command_args: Vec<String>,
104 entrypoint: Option<String>,
105 storages: Vec<Storage>,
106 environment_variables: Vec<EnvironmentVariable>,
107 external_secrets: BTreeMap<String, ExternalSecret>,
108 mounted_files: BTreeSet<MountedFile>,
109 readiness_probe: Option<Probe>,
110 liveness_probe: Option<Probe>,
111 advanced_settings: ApplicationAdvancedSettings,
112 extra_settings: T::AppExtraSettings,
113 mk_event_details: impl Fn(Transmitter) -> EventDetails,
114 annotations_groups: Vec<AnnotationsGroup>,
115 labels_groups: Vec<LabelsGroup>,
116 cpu_request: KubernetesCpuResourceUnit,
117 cpu_limit: KubernetesCpuResourceUnit,
118 ram_request: KubernetesMemoryResourceUnit,
119 ram_limit: KubernetesMemoryResourceUnit,
120 gpu_request: Option<KubernetesGpuResourceUnit>,
121 gpu_limit: Option<KubernetesGpuResourceUnit>,
122 ephemeral_storage_in_gib: Option<u32>,
123 should_delete_shared_registry: bool,
124 autoscaling: Option<AutoscalingConfig>,
125 cpu_architecture: Option<CpuArchitecture>,
126 ) -> Result<Self, ApplicationError> {
127 // TODO: Check that the information provided are coherent
128
129 let workspace_directory = crate::fs::workspace_directory(
130 context.workspace_root_dir(),
131 context.execution_id(),
132 format!("applications/{long_id}"),
133 )
134 .map_err(|_| ApplicationError::InvalidConfig("Can't create workspace directory".to_string()))?;
135
136 let event_details = mk_event_details(Transmitter::Application(long_id, name.to_string()));
137 let mk_event_details = move |stage: Stage| EventDetails::clone_changing_stage(event_details.clone(), stage);
138 let external_secrets = build_external_secret_groups(&kube_name, external_secrets);
139
140 Ok(Self {
141 _marker: PhantomData,
142 mk_event_details: Box::new(mk_event_details),
143 id: to_short_id(&long_id),
144 long_id,
145 action,
146 name: name.to_string(),
147 kube_name,
148 public_domain,
149 ports,

Callers

nothing calls this directly

Calls 8

workspace_directoryFunction · 0.85
to_short_idFunction · 0.85
workspace_root_dirMethod · 0.80
lib_root_dirMethod · 0.80
ApplicationClass · 0.70
execution_idMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected