|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | | -use super::agent::AgentTypeName; |
16 | | -use super::component_metadata::ComponentMetadata; |
17 | 15 | use crate::base_model::account::AccountId; |
18 | 16 | use crate::base_model::component::{ComponentFilePermissions, ComponentRevision, PluginPriority}; |
19 | 17 | use crate::base_model::environment::EnvironmentId; |
20 | 18 | use crate::base_model::oplog::WorkerResourceId; |
21 | 19 | use crate::base_model::regions::OplogRegion; |
22 | 20 | use crate::base_model::{OplogIndex, Timestamp, WorkerId, WorkerResourceDescription, WorkerStatus}; |
23 | | -use crate::model::agent::{ConfigKeyValueType, ConfigValueType}; |
24 | 21 | use crate::{declare_enums, declare_structs, declare_unions}; |
25 | | -use golem_wasm::ValueAndType; |
26 | 22 | use golem_wasm_derive::{FromValue, IntoValue}; |
27 | 23 | use std::collections::{BTreeMap, HashMap, HashSet}; |
28 | 24 | use std::fmt::{Display, Formatter}; |
@@ -74,42 +70,6 @@ pub struct UntypedParsedWorkerCreationLocalAgentConfigEntry { |
74 | 70 | pub value: golem_wasm::Value, |
75 | 71 | } |
76 | 72 |
|
77 | | -impl UntypedParsedWorkerCreationLocalAgentConfigEntry { |
78 | | - pub fn enrich_with_type( |
79 | | - self, |
80 | | - component_metadata: &ComponentMetadata, |
81 | | - agent_type_name: Option<&AgentTypeName>, |
82 | | - ) -> Result<ParsedWorkerCreationLocalAgentConfigEntry, String> { |
83 | | - let agent_type_name = agent_type_name.ok_or_else(|| { |
84 | | - "cannot enrich local agent config for non-agentic workers".to_string() |
85 | | - })?; |
86 | | - |
87 | | - let value_type = component_metadata |
88 | | - .find_agent_type_by_name(agent_type_name) |
89 | | - .ok_or("did not find expected agent type in the metadata")? |
90 | | - .config |
91 | | - .into_iter() |
92 | | - .find_map(|c| match c { |
93 | | - ConfigKeyValueType { |
94 | | - key, |
95 | | - value: ConfigValueType::Local(inner), |
96 | | - } if key == self.key => Some(inner), |
97 | | - _ => None, |
98 | | - }) |
99 | | - .ok_or_else(|| { |
100 | | - format!( |
101 | | - "did not find config key {} in the metadata", |
102 | | - self.key.join(".") |
103 | | - ) |
104 | | - })?; |
105 | | - |
106 | | - Ok(ParsedWorkerCreationLocalAgentConfigEntry { |
107 | | - key: self.key, |
108 | | - value: ValueAndType::new(self.value, value_type.value), |
109 | | - }) |
110 | | - } |
111 | | -} |
112 | | - |
113 | 73 | declare_structs! { |
114 | 74 | pub struct WorkerCreationLocalAgentConfigEntry { |
115 | 75 | pub key: Vec<String>, |
|
0 commit comments