Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ members = [
"resources/sshdconfig",
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_feature",
"resources/windows_firewall",
"tools/dsctest",
"tools/test_group_resource",
Expand Down Expand Up @@ -48,17 +49,18 @@ default-members = [
"lib/dsc-lib-registry",
"resources/runcommandonset",
"lib/dsc-lib-security_context",
"resources/dism_dsc",
"resources/sshdconfig",
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_feature",
"resources/windows_firewall",
"tools/dsctest",
"tools/test_group_resource",
"grammars/tree-sitter-dscexpression",
"grammars/tree-sitter-ssh-server-config",
"y2j",
"xtask"
"xtask",
"resources/dism_dsc"
]

[workspace.metadata.groups]
Expand All @@ -83,6 +85,7 @@ Windows = [
"resources/sshdconfig",
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_feature",
"resources/windows_firewall",
"tools/dsctest",
"tools/test_group_resource",
Expand Down
17 changes: 17 additions & 0 deletions data.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
"windows_firewall.exe",
"windows_service.exe",
"windows_service.dsc.resource.json",
"windows_feature.exe",
"windows_feature.dsc.resource.json",
"wmi.dsc.resource.json",
"wmi.resource.ps1",
"wmiAdapter.psd1",
Expand Down Expand Up @@ -478,6 +480,21 @@
]
}
},
{
"Name": "windows_feature",
"Kind": "Resource",
"RelativePath": "resources/windows_feature",
"SupportedPlatformOS": "Windows",
"IsRust": true,
"Binaries": [
"windows_feature"
],
"CopyFiles": {
"Windows": [
"windows_feature.dsc.resource.json"
]
}
},
{
"Name": "dsctest",
"Kind": "Resource",
Expand Down
4 changes: 2 additions & 2 deletions lib/dsc-lib-registry/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub struct Registry {
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct Metadata {
#[serde(rename = "whatIf", skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub what_if: Option<Vec<String>>
}
10 changes: 10 additions & 0 deletions resources/windows_feature/.project.data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Name": "windows_feature",
"Kind": "Resource",
"IsRust": true,
"SupportedPlatformOS": "Windows",
"Binaries": ["windows_feature"],
"CopyFiles": {
"Windows": ["windows_feature.dsc.resource.json"]
}
}
18 changes: 18 additions & 0 deletions resources/windows_feature/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "windows_feature"
version = "0.1.0"
edition = "2024"

[[bin]]
name = "windows_feature"
path = "src/main.rs"

[package.metadata.i18n]
available-locales = ["en-us"]
default-locale = "en-us"
load-path = "locales"

[dependencies]
rust-i18n = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
35 changes: 35 additions & 0 deletions resources/windows_feature/locales/en-us.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
_version = 1

[main]
missingOperation = "Missing operation. Usage: windows_feature get --input <json> | set --input <json> | export [--input <json>]"
unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, or export"
missingInput = "Missing --input argument"
missingInputValue = "Missing value for --input argument"
invalidJson = "Invalid JSON input: %{error}"
windowsOnly = "This resource is only supported on Windows"

[get]
featuresArrayEmpty = "Features array cannot be empty for get operation"
featureNameRequired = "featureName is required for get operation"

[set]
featuresArrayEmpty = "Features array cannot be empty for set operation"
featureNameRequired = "featureName is required for set operation"
stateRequired = "state is required for set operation"
unsupportedDesiredState = "Unsupported desired state '%{state}'. Supported states for set are: Installed, NotPresent, Removed"

[dism]
failedLoadLibrary = "Failed to load dismapi.dll. Ensure DISM is available on this system."
functionNotFound = "Failed to find function '%{name}' in dismapi.dll"
initializeFailed = "DismInitialize failed: HRESULT %{hr}"
notSupportedAppx = "This resource is not supported when installed via Appx"
openSessionFailed = "DismOpenSession failed: HRESULT %{hr}"
getFeatureInfoFailed = "DismGetFeatureInfo failed for '%{name}': HRESULT %{hr}"
enableFeatureFailed = "DismEnableFeature failed for '%{name}': HRESULT %{hr}"
disableFeatureFailed = "DismDisableFeature failed for '%{name}': HRESULT %{hr}"
getFeaturesFailed = "DismGetFeatures failed: HRESULT %{hr}"

[windows_feature_helper]
whatIfEnable = "Would enable feature '%{name}'"
whatIfDisable = "Would disable feature '%{name}' (remove payload: false)"
whatIfRemove = "Would remove feature '%{name}' (remove payload: true)"
Loading
Loading