commands – io export
Export all, or part of, the servers configuration to a JSON or YAML file.
Usage
export [item …] root [(json|yaml|yml)] [relative]
export [item …] root file.(json|yaml|yml) [relative] [verbose]
where
item | one or more item types to include in the export. Default = calendars, jobs & properties. |
|
acls | export acls. | |
calendars | export calendars. | |
configs | export configs, if root is / . |
|
hosts | export host acls, if root is / . |
|
jobs | export jobs. | |
properties | export properties. | |
protected | export protected users and hosts, if root is / . |
|
all | export all the above item types, if root is / . Otherwise, include all the above items except hosts & protected . |
|
root | group whose contents to export. | |
json|yaml|yml | output as JSON or YAML to the console. Default = yaml . |
|
file.(json|yaml|yml) | output as JSON or YAML to the specified file. | |
relative | use relative (to root) names within the output JSON/YAML. | |
verbose | print name of all items exported, instead of counts of each item type exported. |
read for acl, calendar & job items.
Examples
Export a group to the console as JSON
As a user with read only access, export the group /examples/webhooks to the console as JSON.
BeyondCron % export /examples/webhooks json
{"jobs": [ { "name": "/examples/webhooks/critical-mass", "description": "San Francisco critical mass in 30 minutes", "type": "URL", "mode": "ENABLED", "timezone": "US/Pacific", "schedules": [{ "type": "MONTHLY", "day": "FRIDAY", "time": "17:00:00", "position": 1, "last": true }], "properties": [ { "name": "Content-Type", "value": "application/json", "type": "HEADER" }, { "name": "text", "value": "San Francisco critical mass in 30 minutes" }, { "name": "username", "value": "BeyondCron" } ], "url": "https://example.com/services/T065K944Z/C037HCJA7/fSFooAZpfirBaroyGhyNdmZgX", "method": "POST" }, { "name": "/examples/webhooks/private-property", "description": "Call a webhook with a private header API key", "type": "URL", "mode": "ENABLED", "timezone": "Asia/Tokyo", "schedules": [{ "type": "REPEAT", "period": "30 minutes", "epoch": "07:58:11 09/09/2016" }], "properties": [ { "name": "Content-Type", "value": "application/json", "type": "HEADER" }, { "name": "x-api-key", "value": "********", "secret": true, "type": "HEADER" } ], "url": "https://example.com/prod/random-result", "method": "POST" } ]}
the value of the property x-api-key in job /examples/webhooks/private-property, is masked since the user does not have write access to the job.
Export a group to the console as YAML
Export the same group to the console as YAML.
BeyondCron % export /examples/webhooks
jobs: - name: /examples/webhooks/critical-mass description: San Francisco critical mass in 30 minutes type: URL mode: ENABLED timezone: US/Pacific schedules: - type: MONTHLY day: FRIDAY time: '17:00:00' position: 1 last: true properties: - name: Content-Type value: application/json type: HEADER - name: text value: San Francisco critical mass in 30 minutes - name: username value: BeyondCron url: https://example.com/services/T065K944Z/C037HCJA7/fSFooAZpfirBaroyGhyNdmZgX method: POST - name: /examples/webhooks/private-property description: Call a webhook with a private header API key type: URL mode: ENABLED timezone: Asia/Tokyo schedules: - type: REPEAT period: 30 minutes epoch: 07:58:11 09/09/2016 properties: - name: Content-Type value: application/json type: HEADER - name: x-api-key value: ******** secret: true type: HEADER url: https://example.com/prod/random-result method: POST
Export a group to the console as relative YAML
Export the same group to the console as relative YAML.
BeyondCron % export /examples/webhooks relative
jobs: - name: '.../critical-mass' description: San Francisco critical mass in 30 minutes type: URL mode: ENABLED timezone: US/Pacific schedules: - type: MONTHLY day: FRIDAY time: '17:00:00' position: 1 last: true properties: - name: Content-Type value: application/json type: HEADER - name: text value: San Francisco critical mass in 30 minutes - name: username value: BeyondCron url: https://example.com/services/T065K944Z/C037HCJA7/fSFooAZpfirBaroyGhyNdmZgX method: POST - name: '.../private-property' description: Call a webhook with a private header API key type: URL mode: ENABLED timezone: Asia/Tokyo schedules: - type: REPEAT period: 30 minutes epoch: 07:58:11 09/09/2016 properties: - name: Content-Type value: application/json type: HEADER - name: x-api-key value: ******** secret: true type: HEADER url: https://example.com/prod/random-result method: POST
Export a group to a file
Export the same group to the a file as YAML, printing the names of each item exported.
BeyondCron % export /examples/webhooks /…/webhooks.yaml verbose
Exported: - /examples/webhooks/critical-mass (JOB) - /examples/webhooks/private-property (JOB)
Export entire configuration to a file
Export the entire configuration to a JSON file, printing a count of each item exported.
BeyondCron % export all / /…/server.json
Exported 8 Calendars & 33 Jobs.