The timezone of the host. osapi behavior get --name timezone and
osapi behavior method get show the same.
Behavior
| |
|---|
| Name | timezone |
| Description | The timezone of the host |
| Placement | node |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | linux, darwin |
| Sudo | none |
| Runs | none |
| Writes | none |
| Keeps state | no |
| Uses | none |
| Used by | none |
Methods (2)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|
| get | read | GET | /api/node/{hostname}/timezone | timezone:read | Get the timezone of the host |
| update | write | PUT | /api/node/{hostname}/timezone | timezone:write | Set the timezone of the host |
Types (2)
| NAME | INPUT | OUTPUT |
|---|
| get | GetInput | Entry { timezone, utc_offset } |
| update | UpdateInput { timezone* } | Result { timezone, changed } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| |
|---|
| Span | behavior.timezone.<method> |
| Child spans | exec timedatectl |
| Metrics | osapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total |
| Attributes | osapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed |
| Recorded inputs | timezone (update) |
Method get
| |
|---|
| Name | get |
| Verb | read |
| Description | Get the timezone of the host |
| Detail | Reads the IANA name of the timezone and its offset from UTC now: the zone that /etc/localtime links to, or /etc/timezone on Linux. |
| HTTP | GET |
| Route | /api/node/{hostname}/timezone |
| Permission | timezone:read |
| Command | osapi client node timezone get |
| Input type | GetInput |
| Output type | Entry |
None. The method takes no input; its command needs only --target.
Output (2)
| FIELD | TYPE | DESCRIPTION |
|---|
| timezone | string | The IANA name of the timezone, such as America/New_York |
| utc_offset | string | The offset from UTC now, such as -05:00 |
Examples (2)
| EXAMPLE | INPUT | OUTPUT |
|---|
| A Linux host on UTC | (none) | timezone=UTC, utc_offset=+00:00 |
| A Mac on UTC | (none) | timezone=UTC, utc_offset=+00:00 |
Method update
| |
|---|
| Name | update |
| Verb | write |
| Description | Set the timezone of the host |
| Detail | Sets the timezone with timedatectl set-timezone. A host that already has the timezone does not change and reports changed: false. It runs on the Debian family only, and elsewhere reports skipped. |
| HTTP | PUT |
| Route | /api/node/{hostname}/timezone |
| Permission | timezone:write |
| Command | osapi client node timezone update |
| Input type | UpdateInput |
| Output type | Result |
| FIELD | TYPE | REQUIRED | CONSTRAINTS | DESCRIPTION |
|---|
| timezone | string | yes | pattern ^[A-Za-z0-9_+][A-Za-z0-9_+-](/[A-Za-z0-9_+-]+)$, max length 64 | The IANA name of the timezone, such as UTC or America/New_York |
Output (2)
| FIELD | TYPE | DESCRIPTION |
|---|
| timezone | string | The timezone of the host |
| changed | boolean | Whether the host changed |
Examples (2)
| EXAMPLE | INPUT | OUTPUT |
|---|
| Set a new timezone | timezone=America/New_York | timezone=America/New_York, changed=true |
| A host that already has the timezone | timezone=UTC | timezone=UTC, changed=false |