Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cli for peridio 0.21.2 #193

Merged
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
16 changes: 10 additions & 6 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
module.exports = {
root: true,
plugins: ['@docusaurus'],
extends: ['plugin:@docusaurus/recommended', 'airbnb'],
ignorePatterns: ['build', 'src'],
rules: {
'import/no-unresolved': [2, { ignore: ['^@theme', '^@docusaurus'] }],
semi: [2, 'never'],
'no-use-before-define': ['error', {
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
}],
'no-use-before-define': [
'error',
{
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
},
],
'no-console': ['error', { allow: ['warn', 'error'] }],
},
overrides: [
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/ca-certificates/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Options:
An arbitrary string attached to the resource. Often useful for displaying to users
--jitp-description <JITP_DESCRIPTION>
An arbitrary string attached to the jitp resource. Often useful for displaying to users
--jitp-tags <JITP_TAGS>
--jitp-tags [<JITP_TAGS>...]
Tags that will be automatically applied to devices that JITP with this CA certificate
--jitp-product-name <JITP_PRODUCT_NAME>
The product that will be automatically applied to devices that JITP with this CA certificate
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/ca-certificates/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Options:
Pass this option to disable JITP for this CA certificate
--jitp-description <JITP_DESCRIPTION>
An arbitrary string attached to the jitp resource. Often useful for displaying to users
--jitp-tags <JITP_TAGS>
--jitp-tags [<JITP_TAGS>...]
Tags that will be automatically applied to devices that JITP with this CA certificate
--jitp-product-name <JITP_PRODUCT_NAME>
The product that will be automatically applied to devices that JITP with this CA certificate
Expand Down
4 changes: 2 additions & 2 deletions src/docs/cli/deployments/create.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
```
Usage: peridio deployments create [OPTIONS] --firmware <FIRMWARE> --product-name <PRODUCT_NAME> --name <NAME> --tags <TAGS>
Usage: peridio deployments create [OPTIONS] --firmware <FIRMWARE> --product-name <PRODUCT_NAME> --name <NAME> --tags [<TAGS>...]

Options:
--delta-updatable Whether or not the deployment will leverage Peridio-managed delta updates
--firmware <FIRMWARE> The UUID of the firmware to deploy
--product-name <PRODUCT_NAME> The name of the product you wish to create the resource within
--name <NAME> The resource's name, meant to be displayable to users
--tags <TAGS> A list of tags that must be present on a device for it to be eligible for this deployment
--tags [<TAGS>...] A list of tags that must be present on a device for it to be eligible for this deployment
--version <VERSION> A SemVer requirement that must be satisfied by a device's version for the device to be eligible for this deployment
-h, --help Print help

Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/deployments/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Options:
The name of the product you wish to create the resource within
--name <NAME>
The resource's name, meant to be displayable to users
--tags <TAGS>
--tags [<TAGS>...]
A list of tags that must be present on a device for it to be eligible for this deployment
--version <VERSION>
A SemVer requirement that must be satisfied by a device's version for the device to be eligible for this deployment
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/devices/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Options:
--product-name <PRODUCT_NAME>
The name of the product you wish to create the resource within

--tags <TAGS>
--tags [<TAGS>...]
A list of tags to attach to the device.

If using firmwares and deployments, tags can be used to target devices.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/devices/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Options:
The device's last communication time
--product-name <PRODUCT_NAME>
The name of the product you wish to update the resource within
--tags <TAGS>
--tags [<TAGS>...]
A list of tags to attach to the device
--target <TARGET>
The target of the device
Expand Down
9 changes: 6 additions & 3 deletions src/docs/cli/releases/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Options:
--description <DESCRIPTION>
An arbitrary string attached to the resource. Often useful for displaying to users

--disabled <DISABLED>
If a release is marked as disabled it cannot be resolved during release resolution

[possible values: true, false]

--name <NAME>
The resource's name, meant to be displayable to users

Expand All @@ -24,7 +29,7 @@ Options:
--organization-prn <ORGANIZATION_PRN>
The PRN of the organization you wish to create the resource within

--phase-tags <PHASE_TAGS>
--phase-tags [<PHASE_TAGS>...]
Limits by tags the devices that are allowed to update to this release. When phase_mode is tags, this field only allows devices to update to this release if they have at least one of these tags

--phase-value <PHASE_VALUE>
Expand All @@ -37,8 +42,6 @@ Options:
NOTE: 1 is a special value in that it represents 100% and once a release is updated to this value, the phase value can never be changed again.

A release with a phase_value not equal to 1 is considered "phased".

NOTE: There can only ever be a single release that is phased at a time within a cohort. Because of this, if there is already a phased release, it must be "completed" by setting the phase to 1.

--previous-release-prn <PREVIOUS_RELEASE_PRN>
The PRN of the release you wish to create this release after.
Expand Down
17 changes: 12 additions & 5 deletions src/docs/cli/releases/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Options:
--description <DESCRIPTION>
An arbitrary string attached to the resource. Often useful for displaying to users

--disabled <DISABLED>
If a release is marked as disabled it cannot be resolved during release resolution

[possible values: true, false]

--name <NAME>
The resource's name, meant to be displayable to users

Expand All @@ -19,11 +24,15 @@ Options:
If supplied, the release will be created prior to the release identified by next_release_prn. If you wish to insert this release between two other releases, you may additionally supply previous_release_prn. If you supply neither field, it will create the release as the latest automatically.

--phase-mode <PHASE_MODE>
Enum: "tags" "numeric"
Describes if this release is using tag or numeric based phasing. tags or phase value for resolution

Describes if this release is using tag or numeric based phasing. tags or phase value for resolution - tags - Phases rollout of the release according to the phase_tags field. - numeric - Phases rollout of the release according to the phase_value field.
- tags - Phases rollout of the release according to the phase_tags field.

- numeric - Phases rollout of the release according to the phase_value field.

[possible values: tags, numeric]

--phase-tags <PHASE_TAGS>
--phase-tags [<PHASE_TAGS>...]
Limits by tags the devices that are allowed to update to this release. When phase_mode is tags, this field only allows devices to update to this release if they have at least one of these tags

--phase-value <PHASE_VALUE>
Expand All @@ -36,8 +45,6 @@ Options:
NOTE: 1 is a special value in that it represents 100% and once a release is updated to this value, the phase value can never be changed again.

A release with a phase_value not equal to 1 is considered "phased".

NOTE: There can only ever be a single release that is phased at a time within a cohort. Because of this, if there is already a phased release, it must be "completed" by setting the phase to 1.

--required <REQUIRED>
Whether the release is required.
Expand Down
16 changes: 16 additions & 0 deletions src/docs/cli/tunnels/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```
Usage: peridio tunnels create [OPTIONS] --device-prn <DEVICE_PRN> --device-tunnel-port <DEVICE_TUNNEL_PORT>

Options:
--cidr-block-allowlist <CIDR_BLOCK_ALLOWLIST>
An optional list of CIDR blocks that can use the resource
--device-prn <DEVICE_PRN>
The PRN of the device you wish to create the resource for
--device-tunnel-port <DEVICE_TUNNEL_PORT>
The port of the device that being used for the service
--ttl <TTL>
The length of time in seconds for the tunnel to live
-h, --help
Print help

```
11 changes: 11 additions & 0 deletions src/docs/cli/tunnels/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```
Usage: peridio tunnels list [OPTIONS] --search <SEARCH>

Options:
--limit <LIMIT> Limit the length of the page
--order <ORDER> Specify whether the query is ordered ascending or descending
--search <SEARCH> A search query per the Peridio API's search query language. It is recommended to quote the value of this option
--page <PAGE> A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response (if not null) to request subsequent results
-h, --help Print help

```
9 changes: 9 additions & 0 deletions src/docs/cli/tunnels/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```
Usage: peridio tunnels update [OPTIONS] --prn <PRN>

Options:
--prn <PRN> The PRN of the resource to update
--state <STATE> The resource's state, currently only supports "closed"
-h, --help Print help

```
2 changes: 1 addition & 1 deletion src/docs/cli/webhooks/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Options:
--description <DESCRIPTION>
An arbitrary string attached to the resource. Often useful for displaying to users

--enabled-events <ENABLED_EVENTS>
--enabled-events [<ENABLED_EVENTS>...]
The events that will trigger the webhook.

Supply the flag multiple times to add multiple events.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/webhooks/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Options:
--state <STATE>
The state of the webhook

--enabled-events <ENABLED_EVENTS>
--enabled-events [<ENABLED_EVENTS>...]
The events that will trigger the webhook.

Supply the flag multiple times to add multiple events.
Expand Down
10 changes: 7 additions & 3 deletions src/scripts/gen-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function getSection(section, str) {
function getSubCommands(help) {
const commandsSection = getSection('Commands', help)
const reCommandNames = /([\w-]+).*/g
return [...commandsSection.matchAll(reCommandNames)].map(([, subCommand]) => subCommand).filter((subCommand) => subCommand !== 'help')
return [...commandsSection.matchAll(reCommandNames)]
.map(([, subCommand]) => subCommand)
.filter((subCommand) => subCommand !== 'help')
}

function writeCommandGroup(cmd, subCommands) {
Expand Down Expand Up @@ -52,11 +54,13 @@ function processCommandHelp(cmd) {
}

exec('peridio --version', (_error, stdout) => {
const requiredVersion = 'peridio 0.19.1 1d620b7'
const requiredVersion = 'peridio 0.21.2 46345c1'

if (stdout.includes(requiredVersion)) {
processCommandHelp([])
} else {
console.error(`Your local Peridio CLI has version (${stdout.trim()}) but this script requires version (${requiredVersion})`)
console.error(
`Your local Peridio CLI has version (${stdout.trim()}) but this script requires version (${requiredVersion})`,
)
}
})
Loading