Documentation
¶
Index ¶
- Variables
- func Routes(s *server.Server) []server.Route
- type CreateRequest
- type DeleteRequest
- type GetRequest
- type ListRequest
- type SysctlCollectionResponse
- type SysctlCreateRequest
- type SysctlCreateResponse
- type SysctlDeleteResponse
- type SysctlEntry
- type SysctlGetResponse
- type SysctlMutationResult
- type SysctlUpdateRequest
- type SysctlUpdateResponse
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
var Group = endpoint.Define( "sysctl", "Kernel parameters, written to sysctl.d files and applied", endpoint.Area(area.Config), endpoint.Prefix("node/{hostname}"), endpoint.Uses[dispatch.Deps](), endpoint.Tag("sysctl_operations", "Sysctl", "Kernel parameters, written to sysctl.d files and applied"), endpoint.CommandNotes("The [sysctl behavior](../../../../../reference/behaviors/config/sysctl/sysctl.md) page tells where the behavior runs, what it is built on and its settings."), endpoint.Doc[types.RowStatus](dispatch.RowStatusDoc), endpoint.Get[ListRequest, SysctlCollectionResponse]("list"). Handle(HandleList). ID("GetNodeSysctl"). Describe("List the kernel's parameters and which osapi manages"). Permission("sysctl:read"). Returns("Each target host's result."). Explain("Lists every parameter the kernel shows under /proc/sys, with its current value, as sysctl -a does, and marks the ones osapi manages. A prefix, such as net.ipv4, limits the list to that part of the tree. The kernel can lack a parameter that osapi manages, for example when its module is not loaded. Then the list shows the value that osapi wrote."). Example("--target web-01", "Every parameter, and which osapi manages"). Example("--target web-01 --prefix net.ipv4", "One part of the tree"). Example("--target web-01 --prefix net.bridge", "A managed parameter the kernel does not have right now"). Result("Every parameter, and which osapi manages, on one host:\n\n```ansi\n$ osapi client node sysctl list --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m kernel.panic 0 no\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl list --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m kernel.panic 0 no\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m kernel.panic 0 no\n \x1b[38;2;138;138;138mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"kernel.panic\",\n \"managed\": false,\n \"status\": \"ok\",\n \"value\": \"0\"\n },\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ip_forward\",\n \"managed\": true,\n \"status\": \"ok\",\n \"value\": \"1\"\n },\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ping_group_range\",\n \"managed\": false,\n \"status\": \"ok\",\n \"value\": \"0 2147483647\"\n }\n ]\n}\n```\n\nOne part of the tree, on one host:\n\n```ansi\n$ osapi client node sysctl list --target web-01 --prefix net.ipv4\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl list --target _all --prefix net.ipv4\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ip_forward 1 yes\n \x1b[38;2;138;138;138mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ip_forward\",\n \"managed\": true,\n \"status\": \"ok\",\n \"value\": \"1\"\n },\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ping_group_range\",\n \"managed\": false,\n \"status\": \"ok\",\n \"value\": \"0 2147483647\"\n }\n ]\n}\n```\n\nA managed parameter the kernel does not have right now, on one host:\n\n```ansi\n$ osapi client node sysctl list --target web-01 --prefix net.bridge\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl list --target _all --prefix net.bridge\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.bridge.bridge-nf-call-iptables\",\n \"managed\": true,\n \"status\": \"ok\",\n \"value\": \"1\"\n }\n ]\n}\n```\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A prefix that is not a parameter name | `--prefix ../etc` | invalid sysctl key |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Get[GetRequest, SysctlGetResponse]("get"). Handle(HandleGet). ID("GetNodeSysctlByKey"). Describe("Get a kernel parameter's current value, and whether osapi manages it"). Permission("sysctl:read"). Returns("Each target host's result."). Example("--target web-01 --key vm.swappiness", "A parameter osapi manages"). Example("--target web-01 --key vm.swappiness", "A parameter osapi does not manage"). Example("--target web-01 --key net.ipv4.ping_group_range", "A value of several fields"). Example("--target web-01 --key net.bridge.bridge-nf-call-iptables", "A managed parameter the kernel does not have right now"). Result("A parameter osapi manages, on one host:\n\n```ansi\n$ osapi client node sysctl get --target web-01 --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 10 yes\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl get --target _all --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 10 yes\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 10 yes\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"managed\": true,\n \"status\": \"ok\",\n \"value\": \"10\"\n }\n ]\n}\n```\n\nA parameter osapi does not manage, on one host:\n\n```ansi\n$ osapi client node sysctl get --target web-01 --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 60 no\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl get --target _all --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 60 no\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness 60 no\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"managed\": false,\n \"status\": \"ok\",\n \"value\": \"60\"\n }\n ]\n}\n```\n\nA value of several fields, on one host:\n\n```ansi\n$ osapi client node sysctl get --target web-01 --key net.ipv4.ping_group_range\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl get --target _all --key net.ipv4.ping_group_range\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.ipv4.ping_group_range 0 2147483647 no\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ping_group_range\",\n \"managed\": false,\n \"status\": \"ok\",\n \"value\": \"0 2147483647\"\n }\n ]\n}\n```\n\nA managed parameter the kernel does not have right now, on one host:\n\n```ansi\n$ osapi client node sysctl get --target web-01 --key net.bridge.bridge-nf-call-iptables\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl get --target _all --key net.bridge.bridge-nf-call-iptables\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY \x1b[0m\x1b[38;2;10;143;176mVALUE \x1b[0m\x1b[38;2;10;143;176mMANAGED\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m net.bridge.bridge-nf-call-iptables 1 yes\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"key\": \"net.bridge.bridge-nf-call-iptables\",\n \"managed\": true,\n \"status\": \"ok\",\n \"value\": \"1\"\n }\n ]\n}\n```\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A parameter the kernel does not have | `--key vm.nosuch` | not found |\n| No key | | key must not be empty |\n| A key that is not a parameter name | `--key \"vm.swappiness;reboot\"` | invalid sysctl key |\n| A key holding a value | `--key vm.swappiness=1` | invalid sysctl key |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no sysctl with that key."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Post[CreateRequest, SysctlCreateResponse]("create"). Handle(HandleCreate). ID("PostNodeSysctl"). Describe("Manage a kernel parameter and apply it"). Permission("sysctl:write"). Returns("Each target host's result, with whether it changed."). Explain("Writes osapi-net.ipv4.ip_forward.conf for net.ipv4.ip_forward to behaviors.sysctl.dir, /etc/sysctl.d by default, and applies it with sysctl -p. It fails when sysctl -p fails, because the value is not set. A second run with the same value changes nothing and reports changed: false. If the kernel has a different value, for example after a failed apply, it applies the value again."). Example("--target web-01 --key net.ipv4.ip_forward --value 1", "Turn on IP forwarding"). Result("Turn on IP forwarding, on one host:\n\n```ansi\n$ osapi client node sysctl create --target web-01 --key net.ipv4.ip_forward --value 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m net.ipv4.ip_forward\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl create --target _all --key net.ipv4.ip_forward --value 1\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m net.ipv4.ip_forward\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m net.ipv4.ip_forward\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"key\": \"net.ipv4.ip_forward\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Turn on IP forwarding | writes `/etc/sysctl.d/osapi-net.ipv4.ip_forward.conf`: `net.ipv4.ip_forward = 1`; runs `sysctl -p /etc/sysctl.d/osapi-net.ipv4.ip_forward.conf` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| No key | `--value 1` | key must not be empty |\n| A key that is not a parameter name | `--key ../etc/passwd --value 1` | invalid sysctl key |\n| A key that would read as a flag | `--key -w --value 1` | invalid sysctl key |\n| A key that would be a hidden file | `--key .hidden --value 1` | invalid sysctl key |\n| No value | `--key vm.swappiness` | value must not be empty |\n| A value on two lines | `--key vm.swappiness --value \"10\\nkernel.panic = 0\"` | line breaks |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Put[UpdateRequest, SysctlUpdateResponse]("update"). Handle(HandleUpdate). ID("PutNodeSysctl"). Describe("Set a kernel parameter, manage it, and apply it"). Permission("sysctl:write"). Returns("Each target host's result, with whether it changed."). Explain("The same as create, addressed by the parameter: osapi manages the parameter from then on whether it did before or not. Setting the value it already has reports changed: false."). Example("--target web-01 --key vm.swappiness --value 10", "Lower swappiness"). Example("--target web-01 --key vm.swappiness --value 10", "A parameter osapi did not manage"). Result("Lower swappiness, on one host:\n\n```ansi\n$ osapi client node sysctl update --target web-01 --key vm.swappiness --value 10\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl update --target _all --key vm.swappiness --value 10\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA parameter osapi did not manage, on one host:\n\n```ansi\n$ osapi client node sysctl update --target web-01 --key vm.swappiness --value 10\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl update --target _all --key vm.swappiness --value 10\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Lower swappiness | writes `/etc/sysctl.d/osapi-vm.swappiness.conf`: `vm.swappiness = 10`; runs `sysctl -p /etc/sysctl.d/osapi-vm.swappiness.conf` |\n| A parameter osapi did not manage | writes `/etc/sysctl.d/osapi-vm.swappiness.conf`: `vm.swappiness = 10`; runs `sysctl -p /etc/sysctl.d/osapi-vm.swappiness.conf` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| No key | `--value 10` | key must not be empty |\n| A key that is not a parameter name | `--key \"vm.swappiness;reboot\" --value 1` | invalid sysctl key |\n| A key holding a value | `--key vm.swappiness=1 --value 1` | invalid sysctl key |\n| No value | `--key vm.swappiness` | value must not be empty |\n| A value on two lines | `--key vm.swappiness --value \"10\\nkernel.panic = 0\"` | line breaks |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no sysctl with that key."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), endpoint.Delete[DeleteRequest, SysctlDeleteResponse]("delete"). Handle(HandleDelete). ID("DeleteNodeSysctl"). Describe("Stop the management of a kernel parameter"). Permission("sysctl:write"). Returns("Each target host's result, with whether it changed."). Explain("Removes the file that osapi wrote for it and reloads with sysctl --system. Then a setting for the key in a different file takes effect. If there is no such setting, the parameter keeps its current value until the next reboot. A delete of a parameter that osapi does not manage reports changed: false."). Example("--target web-01 --key vm.swappiness", "Remove a parameter"). Example("--target web-01 --key vm.swappiness", "A parameter osapi does not manage"). Example("--target web-01 --key vm.swappiness", "A parameter osapi already stopped managing"). Result("Remove a parameter, on one host:\n\n```ansi\n$ osapi client node sysctl delete --target web-01 --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl delete --target _all --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mchanged\x1b[0m vm.swappiness\n\n 3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": true,\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA parameter osapi does not manage, on one host:\n\n```ansi\n$ osapi client node sysctl delete --target web-01 --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl delete --target _all --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nA parameter osapi already stopped managing, on one host:\n\n```ansi\n$ osapi client node sysctl delete --target web-01 --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node sysctl delete --target _all --key vm.swappiness\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mKEY\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m vm.swappiness\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"changed\": false,\n \"hostname\": \"web-01\",\n \"key\": \"vm.swappiness\",\n \"status\": \"ok\"\n }\n ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Remove a parameter | removes `/etc/sysctl.d/osapi-vm.swappiness.conf`; runs `sysctl --system` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| No key | | key must not be empty |\n| A key that is not a parameter name | `--key \"vm.swappiness;reboot\"` | invalid sysctl key |\n| A key holding a value | `--key vm.swappiness=1` | invalid sysctl key |"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no sysctl with that key."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), )
Group is sysctl as an endpoint group, which its spec comes from.
Functions ¶
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Body SysctlCreateRequest `in:"body" validate:"required"`
}
CreateRequest is the request of sysctl create: its target and its input.
type DeleteRequest ¶
type DeleteRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Key string `doc:"Parameter name, such as net.ipv4.ip_forward" in:"path" json:"key" param:"SysctlKey" validate:"required,min=1,sysctl_key"`
}
DeleteRequest is the request of sysctl delete: its target and its input.
type GetRequest ¶
type GetRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Key string `doc:"Parameter name, such as net.ipv4.ip_forward" in:"path" json:"key" param:"SysctlKey" validate:"required,min=1,sysctl_key"`
}
GetRequest is the request of sysctl get: its target and its input.
type ListRequest ¶
type ListRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Prefix string `doc:"Only this parameter and the ones under it, such as net.ipv4" in:"query" json:"prefix" validate:"omitempty,sysctl_key"`
}
ListRequest is the request of sysctl list: its target and its input.
type SysctlCollectionResponse ¶
type SysctlCollectionResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []SysctlEntry `json:"results"`
}
SysctlCollectionResponse is each target host's result.
func HandleList ¶
func HandleList( ctx context.Context, d dispatch.Deps, in ListRequest, ) (SysctlCollectionResponse, error)
HandleList runs sysctl list on the target, for the endpoint server.
type SysctlCreateRequest ¶
type SysctlCreateRequest struct {
Key string `doc:"Parameter name, such as net.ipv4.ip_forward" json:"key" validate:"required,min=1,sysctl_key"`
Value string `doc:"Value to set" json:"value" validate:"required,no_linebreak"`
}
SysctlCreateRequest is the body of sysctl create.
type SysctlCreateResponse ¶
type SysctlCreateResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []SysctlMutationResult `json:"results"`
}
SysctlCreateResponse is each target host's result.
func HandleCreate ¶
func HandleCreate( ctx context.Context, d dispatch.Deps, in CreateRequest, ) (SysctlCreateResponse, error)
HandleCreate runs sysctl create on the target, for the endpoint server.
type SysctlDeleteResponse ¶
type SysctlDeleteResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []SysctlMutationResult `json:"results"`
}
SysctlDeleteResponse is each target host's result.
func HandleDelete ¶
func HandleDelete( ctx context.Context, d dispatch.Deps, in DeleteRequest, ) (SysctlDeleteResponse, error)
HandleDelete runs sysctl delete on the target, for the endpoint server.
type SysctlEntry ¶
type SysctlEntry struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Key *string `doc:"Parameter name" json:"key,omitempty"`
Value *string `doc:"Current runtime value" json:"value,omitempty"`
Managed *bool `doc:"Whether osapi manages it: a file of its own sets it at boot" json:"managed,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
SysctlEntry is the result of sysctl on one host.
type SysctlGetResponse ¶
type SysctlGetResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []SysctlEntry `json:"results"`
}
SysctlGetResponse is each target host's result.
func HandleGet ¶
func HandleGet( ctx context.Context, d dispatch.Deps, in GetRequest, ) (SysctlGetResponse, error)
HandleGet runs sysctl get on the target, for the endpoint server.
type SysctlMutationResult ¶
type SysctlMutationResult struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Key *string `doc:"Parameter name" json:"key,omitempty"`
Changed *bool `doc:"Whether the host changed" json:"changed,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
SysctlMutationResult is the result of sysctl on one host.
type SysctlUpdateRequest ¶
type SysctlUpdateRequest struct {
Value string `doc:"Value to set" json:"value" validate:"required,no_linebreak"`
}
SysctlUpdateRequest is the body of sysctl update.
type SysctlUpdateResponse ¶
type SysctlUpdateResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []SysctlMutationResult `json:"results"`
}
SysctlUpdateResponse is each target host's result.
func HandleUpdate ¶
func HandleUpdate( ctx context.Context, d dispatch.Deps, in UpdateRequest, ) (SysctlUpdateResponse, error)
HandleUpdate runs sysctl update on the target, for the endpoint server.
type UpdateRequest ¶
type UpdateRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
Key string `doc:"Parameter name, such as net.ipv4.ip_forward" in:"path" json:"key" param:"SysctlKey" validate:"required,min=1,sysctl_key"`
Body SysctlUpdateRequest `in:"body" validate:"required"`
}
UpdateRequest is the request of sysctl update: its target and its input.