docs

package
v0.0.0-...-6c4dc6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApplianceRootDoc = CommandDoc{
		Short: "Manage the appliances and perform tasks such as backups, upgrades, metrics etc",
		Long: `The base command to manage the appliances. This command does not do anything by itself, it is
used together with one of the available sub-commands listed below.`,
	}
	ApplianceListDoc = CommandDoc{
		Short: "List all appliances",
		Long: `List all appliances in the Collective. The appliances will be listed in no particular order. Using without arguments
will print a table view with a limited set of information. Using the command with the provided '--json' flag will print out a more detailed
list view in json format. The list command can also be combined with the global '--include' and '--exclude' flags`,
		Examples: []ExampleDoc{
			{
				Description: "Default list command",
				Command:     "sdpctl appliance list",
				Output: `Name                                                   ID                                    Hostname                 Site          Activated
----                                                   --                                    --------                 ----          ---------
controller                                             67f7ee0c-924c-4253-8b78-0882ff0665ab  controller.dev           Default Site  true
gateway                                                ec3b6270-ad7e-447a-a6e6-8f4ae816cab5  gateway.dev              Default Site  true`,
			},
			{
				Description: "Print list of appliances in json format",
				Command:     "sdpctl appliance list --json",
			},
			{
				Description: "Print a filtered list of appliances",
				Command:     "sdpctl appliance list --include=<key>=<value>",
			},
		},
	}
	ApplianceBackupDoc = CommandDoc{
		Short: "Perform backup of the appliances",
		Long: `The backup command will request a backup from the API and download them to a destination directory. The command requires the Backup API to be enabled in
the Collective. In case the Backup API is not enabled when executing the backup command, you will be prompted to activate it.

There are multiple options for selecting which Appliances to backup, using flags or optional arguments. The arguments are expected to be the name of
the appliance you want to take a backup of.

The default destination directory is set to be the users default downloads directory on the system. If the default destination is used, an 'appgate' directory
will be created there if it doesn't already exist and the backups will be downloaded to that. In case custom destination directory is specified by using the
'--destination' flag, the extra 'appgate' directory will not be created. The user also has to have write privileges on the specified directory.

For more information on the backup process, go to: https://sdphelp.appgate.com/adminguide/v5.5/backup-script.html`,
		Examples: []ExampleDoc{
			{
				Description: "Backup with no arguments or flags will prompt for appliance",
				Command:     "sdpctl appliance backup",
				Output: `? Backup API is disabled on the appliance. Do you want to enable it now? Yes
? The passphrase to encrypt the appliance backups when the Backup API is used: <password> # only shows if Backup API is not enabled
? Confirm your passphrase: <password> # only shows if Backup API is not enabled
? select appliances to backup:  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
❯ [ ]  controller
  [ ]  gateway`,
			},
			{
				Description: "download backups to a custom directory",
				Command:     "sdpctl appliance backup --destination=path/to/backup/destination",
			},
			{
				Description: "backup only the primary Controller using flag",
				Command:     "sdpctl appliance backup --primary",
			},
			{
				Description: "backup all appliances",
				Command:     "sdpctl appliance backup --all",
			},
			{
				Description: "backup using '--include' and '--exclude' flags",
				Command:     "sdpctl appliance backup --include=function=controller --exclude=tag=secondary",
			},
		},
	}
	ApplianceBackupAPIDoc = CommandDoc{
		Short: "Controls the state of the Backup API",
		Long: `This command controls the state of the Backup API on the Collective.
You will be prompted for a passphrase for the backups when enabling the Backup API using this command.
The passphrase is required.`,
		Examples: []ExampleDoc{
			{
				Description: "enable the Backup API",
				Command:     "appgate appliance backup api",
			},
			{
				Description: "disable the Backup API",
				Command:     "sdpctl appliance backup api --disable",
			},
		},
	}
	ApplianceUpgradeDoc = CommandDoc{
		Short: "Perform appliance upgrade on the Collective",
		Long: `The upgrade procedure is divided into two parts,
  - prepare: Upload the image new appliance image to the Collective.
  - complete: Install a prepared upgrade on the secondary partition and perform a reboot to make the second partition the primary.

Additional subcommands included are:
  - status: view the current upgrade status on all appliances.
  - cancel: Cancel a prepared upgrade.
`,
	}
	ApplianceUpgradeStatusDoc = CommandDoc{
		Short: "Display the upgrade status of Appliances",
		Long: `Display the upgrade status of Appliances in either table or json format.
Upgrade statuses:
- idle:         No upgrade is initiated
- started:      Upgrade process has started
- downloading:  Appliance is downloading the upgrade image
- verifying:    Upgrade image download is completed and the image is being verified
- ready:        Image is verified and ready to be applied
- installing:   Appliance is installing the upgrade image
- success:      Upgrade successful
- failed:       Upgrade failed for some reason during the process`,
		Examples: []ExampleDoc{
			{
				Description: "view in table format",
				Command:     "sdpctl appliance upgrade status",
			},
			{
				Description: "view in JSON format",
				Command:     "sdpctl appliance upgrade status --json",
			},
			{
				Description: "filtered appliance status list",
				Command:     "sdpctl appliance upgrade status --include=name=controller",
			},
		},
	}
	ApplianceUpgradePrepareDoc = CommandDoc{
		Short: "Prepare the appliances for upgrade",
		Long: `Prepare an upgrade but do NOT install it.
This means the upgrade file will be downloaded/uploaded to all the appliances,
the signature verified as well as any other preconditions applicable at this point.

There are initial checks on the filename before attempting to upload it to the Appliances.
If a local upgrade image is uploaded to the Controller, the only pre-condition is that the filename ends with the file extension '.img.zip'.
If, however, the file is hosted on a server and a URL is provided to the prepare command, the filename should also contain a version, such as 6.0.3.
Otherwise the prepare will fail.

Note that the '--image' flag also accepts URL:s. The Appliances will then attempt to download
the upgrade image using the provided URL. It will fail if the Appliances cannot access the URL.`,
		Examples: []ExampleDoc{
			{
				Description: "prepare an upgrade from a local upgrade image",
				Command:     "sdpctl appliance upgrade prepare --image=/path/to/upgrade-5.5.3.img.zip",
			},
			{
				Description: "prepare an upgrade from remote upgrade image",
				Command:     "sdpctl appliance upgrade prepare --image=https://upgrade-host.com/upgrade-5.5.3.img.zip",
			},
			{
				Description: "use the primary Controller as an upgrade image host for the other appliances",
				Command:     "sdpctl appliance upgrade prepare --image=https://upgrade-host.com/upgrade-5.5.3.img.zip --host-on-controller",
			},
			{
				Description: "prepare only certain appliances based on a filter",
				Command:     "sdpctl appliance upgrade prepare --image=/path/to/image-5.5.3.img.zip --include function=controller",
			},
		},
	}
	ApplianceUpgradeCancelDoc = CommandDoc{
		Short: "Cancel a prepared upgrade on one or more appliances",
		Long: `Cancel a prepared upgrade. The command will attempt to cancel upgrades on
Appliances that are not in the 'idle' upgrade state. Cancelling will remove the
upgrade image from the Appliance, though it will not remove images hosted in the primary
controller file repository (such as when using the '--host-on-controller' flag) by default.
To remove them as well, you can use the '--delete' flag.

Note that you can cancel upgrades on specific appliances by using the '--include' and/or
'--exclude' flags in combination with this command.`,
		Examples: []ExampleDoc{
			{
				Description: "cancel upgrade on all Appliances",
				Command:     "sdpctl appliance upgrade cancel",
			},
			{
				Description: "cancel upgrade on selected Appliances",
				Command:     "sdpctl appliance upgrade cancel --include function=gateway",
			},
			{
				Description: "cancel upgrade and delete all dangling upgrade images",
				Command:     "sdpctl appliance upgrade cancel --delete",
			},
		},
	}
	ApplianceUpgradeCompleteDoc = CommandDoc{
		Short: "Complete the upgrade on prepared appliances",
		Long: `Complete a prepared upgrade.
Install a prepared upgrade on the secondary partition
and perform a reboot to make the second partition the primary.`,
		Examples: []ExampleDoc{
			{
				Description: "complete all pending upgrades",
				Command:     "sdpctl appliance upgrade complete",
			},
			{
				Description: "backup the primary Controller before completing",
				Command:     "sdpctl appliance upgrade complete --backup",
			},
			{
				Description: "backup to custom directory when completing pending upgrade",
				Command:     "sdpctl appliance upgrade complete --backup --backup-destination=/path/to/custom/destination",
			},
		},
	}
	ApplianceMetricsDoc = CommandDoc{
		Short: "Get all the Prometheus metrics for the given Appliance",
		Long: `The 'metric' command will return a list of all the available metrics provided by an appliance for use in Prometheus.
If no appliance ID is given as an argument, the command will prompt for which Appliance you want metrics for. A second argument can be used
to get a specific metric name. This needs to be an exact match.`,
		Examples: []ExampleDoc{
			{
				Description: "list all available appliance metrics",
				Command:     "sdpctl appliance metric",
			},
			{
				Description: "list metrics for a particular appliance",
				Command:     "sdpctl appliance metric <appliance-id>",
			},
			{
				Description: "get a particular metric from an appliance",
				Command:     "sdpctl appliance metric <appliance-id> <metric-name>",
			},
		},
	}
	ApplianceResolveNameDoc = CommandDoc{
		Short: "Test a resolver name on a Gateway",
		Long: `Test a resolver name on a Gateway. Name resolvers are used by the Gateways on a Site resolve
the IPs in the specific network or set of protected resources.`,
		Examples: []ExampleDoc{
			{
				Description: "with a specific gateway appliance id",
				Command:     "sdpctl appliance resolve-name d750ad44-7c6a-416d-773b-f805a2272418 dns://google.se",
			},
			{
				Description: "If you omit appliance id, you will be prompted with all online gateways, and you can select one to test on",
				Command:     "sdpctl appliance resolve-name dns://google.se",
				Output: `? select appliance: gateway-9a9b8b70-faaa-4059-a061-761ce13783ba-site1 - Default Site - []
142.251.36.3
2a00:1450:400e:80f::2003`,
			},
		},
	}
	ApplianceResolveNameStatusDoc = CommandDoc{
		Short: "Get the status of name resolution on a Gateway",
		Long: `Get the status of name resolution on a Gateway. It lists all the subscribed resource names from all the connected
Clients and shows the resolution results`,
		Examples: []ExampleDoc{
			{
				Description: "with a specific gateway appliance id",
				Command:     "sdpctl appliance resolve-name-status 7f340572-0cd3-416b-7755-9f5c4e546391 --json",
				Output: `{
    "resolutions": {
        "aws://lb-tag:kubernetes.io/service-name=opsnonprod/erp-dev": {
            "partial": false,
            "finals": [
                "3.120.51.78",
                "35.156.237.184"
            ],
            "partials": [
                "dns://all.GW-ELB-2001535196.eu-central-1.elb.amazonaws.com",
                "dns://all.purple-lb-1785267452.eu-central-1.elb.amazonaws.com"
            ],
            "errors": []
        }
    }
}`,
			},
		},
	}
	ApplianceStatsDocs = CommandDoc{
		Short: "Show appliance stats",
		Long: `Show current stats, such as current system resource consumption, appliance version etc, for the appliances.
Using the '--json' flag will return a more detailed list of stats in json format.

NOTE: Although the '--include' and '--exclude' flags are provided as options here, they don't have any actual effect on the command.`,
		Examples: []ExampleDoc{
			{
				Description: "default listing of stats",
				Command:     "sdpctl appliance stats",
			},
			{
				Description: "print stats in JSON format",
				Command:     "sdpctl appliance stats --json",
			},
		},
	}

	ApplianceLogsDoc = CommandDoc{
		Short: "Download zip bundle with logs",
		Long:  `Download a zip bundle with all logs from a appliance`,
		Examples: []ExampleDoc{
			{
				Description: "Default logs command",
				Command:     "sdpctl appliance logs",
			},
			{
				Description: "Default logs to specific path",
				Command:     "sdpctl appliance logs a68c1f69-534d-4060-a052-b223d42bac2c --path /tmp",
			},
		},
	}

	ApplianceSeedDocs = CommandDoc{
		Short: "Export seed for an inactive Appliance",
		Long: `Generate a seed file in JSON (or iso format)


for More information, see: https://sdphelp.appgate.com/adminguide/new-appliance.html
        `,
		Examples: []ExampleDoc{
			{
				Description: "export seed file in JSON format with cloud authentication",
				Command:     "sdpctl appliance export-seed 08cd20c0-f175-4503-96f7-c5b429c19236 --provide-cloud-ssh-key",
			},
			{
				Description: "export seed file in iso format with passphrase",
				Command:     `echo "YourSuperSecretPassword" | sdpctl appliance export-seed 08cd20c0-f175-4503-96f7-c5b429c19236 --iso-format`,
			},
			{
				Description: "Interactive prompt to configure the seed file",
				Command:     "sdpctl appliance export-seed",
			},
		},
	}

	ApplianceForceDisableControllerDocs = CommandDoc{
		Short: "Force disable misbehaving Controllers using this command. USE WITH CAUTION!",
		Long: `Force disable Controllers that are misbehaving in any way. This will send a disable command to the primary Controller, which will notify the remaining Controllers of the change.
The command will accept one or more hostnames or ID:s of Controllers that will be disabled as an argument. You can get the hostnames by running 'sdpctl appliance stats'.`,
		Examples: []ExampleDoc{
			{
				Description: "force disable a Controller with the hostname 'failedcontroller.example.com'",
				Command:     "sdpctl appliance force-disable-controller failedcontroller.example.com",
			},
			{
				Description: "force disable multiple controllers",
				Command:     "sdpctl appliance force-disable-controller failed1.example.com failed2.example.com",
			},
			{
				Description: "force disable using ID:s",
				Command:     "sdpctl appliance force-disable-controller f905ff0b-91a6-4d12-afbe-f9a9506f02da",
			},
			{
				Description: "using the command without arguments will prompt for which controllers to disable",
				Command:     "sdpctl appliance force-disable-controller",
				Output: `? Select Controllers to force disable  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
[ ] failed-controller-1 (failed1.example.com)
[ ] failed-controller-2 (failed2.example.com)
[ ] offline-controller (offline.example.com) [OFFLINE]`,
			},
		},
	}
	ApplianceFunctionsDownloadDocs = CommandDoc{
		Short: "Download functions as container bundles",
		Long:  "Download appliance functions as container bundles. The container bundles can then be uploaded to the SDP Collective to enable the function contained in the bunde. Note that currently only the LogServer function is available for container bundle download.",
		Examples: []ExampleDoc{
			{
				Command:     "sdpctl appliance functions download LogServer",
				Description: "download the LogServer function as a bundle",
			},
			{
				Command:     "sdpctl appliance functions download LogServer --save-path=<download-path>",
				Description: "Save the container bundles in a custom path. This is expected to be a directory. If the directory does not exist, sdpctl will try to create it.",
			},
			{
				Command:     "sdpctl appliance functions download LogServer --docker-registry=<path-to-custom-docker-registry>",
				Description: "Download the functions from a custom docker registry.",
			},
		},
	}
	ApplianceSwitchPartitionDocs = CommandDoc{
		Short: "Initiate a partition switch on an appliance regardless of upgrade status",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Command:     "sdpctl appliance switch-partition <appliance-id>",
				Description: "executing the command with a valid appliance id will initiate the partition switch on the appliance with the matching id",
				Output:      ``,
			},
			{
				Command:     "sdpctl appliance switch-partition",
				Description: "executing the command with no argument will prompt for the appliance to make the partition switch on",
				Output: `? select appliance:  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
[ ] controller
[ ] gateway`,
			},
		},
	}
)
View Source
var (
	ConfigureDocs = CommandDoc{
		Short: "Configure your Collective",
		Long: `Setup a configuration file towards your Collective to be able to interact with the collective. By default, the configuration file
will be created in a default directory in depending on your system. This can be overridden by setting the 'SDPCTL_CONFIG_DIR' environment variable.
See 'sdpctl help environment' for more information on using environment variables.`,
		Examples: []ExampleDoc{
			{
				Description: "basic configuration command",
				Command:     "sdpctl configure",
			},
			{
				Description: "configuration, no interactive",
				Command:     "sdpctl configure company.controller.com",
			},
			{
				Description: "configure sdpctl using a custom certificate file",
				Command:     "sdpctl configure --pem=/path/to/pem",
			},
			{
				Description: "configure using a custom confiuration directory",
				Command:     "SDPCTL_CONFIG_DIR=/path/config/dir sdpctl configure",
			},
		},
	}
	ConfigureSigninDocs = CommandDoc{
		Short: "Sign in and authenticate to Collective",
		Long: `Sign in to the Collective using the configuration file created by the 'sdpctl configure' command.
This will fetch a token on valid authentication which will be valid for 24 hours and stored in the configuration.`,
		Examples: []ExampleDoc{
			{
				Description: "default sign in command",
				Command:     "sdpctl configure signin",
			},
		},
	}
)
View Source
var (
	FilesDocs = CommandDoc{
		Short:    "The files command lets you manage the file repository on the connected Controller",
		Long:     `The files command lets you manage the file repository on the currently connected Controller.`,
		Examples: []ExampleDoc{},
	}
	FilesListDocs = CommandDoc{
		Short: "Lists the files in the Controllers file repository",
		Long: `Lists the files in the Controllers file repository. Default output is in table format.
Optionally print the output in JSON format by using the "--json" flag`,
		Examples: []ExampleDoc{
			{
				Description: "list files table output",
				Command:     "sdctl files list",
				Output: `Name                                Status    Created                                 Modified                                Failure Reason
----                                ------    -------                                 --------                                --------------
appgate-6.0.1-29983-beta.img.zip    Ready     2022-08-19 08:06:20.909002 +0000 UTC    2022-08-19 08:06:20.909002 +0000 UTC`,
			},
			{
				Description: "list files using JSON output",
				Command:     "sdctl files list --json",
				Output: `[
  {
    "creationTime": "2022-08-19T08:06:20.909002Z",
    "lastModifiedTime": "2022-08-19T08:06:20.909002Z",
    "name": "appgate-6.0.1-29983-beta.img.zip",
    "status": "Ready"
  }
]`,
			},
		},
	}
	FilesDeleteDocs = CommandDoc{
		Short: "Delete files from the repository",
		Long:  `Delete files from the repository with this command. There are multiple options on which file(s) should be deleted.`,
		Examples: []ExampleDoc{
			{
				Description: "delete a single file using the filename as a parameter",
				Command:     "sdpctl appliance files delete file-to-delete.img.zip",
				Output:      "file-to-delete.img.zip: deleted",
			},
			{
				Description: "delete all files in the repository",
				Command:     "sdpctl appliance files delete --all",
				Output: `deleted1.img.zip: deleted
deleted2.img.zip: deleted`,
			},
			{
				Description: "no arguments will prompt for which files to delete",
				Command:     "sdpctl appliance files delete",
				Output: `? select files to delete:  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
❯ [ ]  file1.img.zip
  [ ]  file2.img.zip
  [ ]  file3.img.zip
`,
			},
		},
	}
	FilesUploadDocs = CommandDoc{
		Short: "upload a file to the primary controllers file repository",
		Long:  `upload one or multiple files to the primary controller file repository. Optionally you can give the file a new name on the server using the '=' with the filepath (see examples for more details)`,
		Examples: []ExampleDoc{
			{
				Description: "upload one file",
				Command:     "sdpctl appliance files upload <path-to-file>",
			},
			{
				Description: "upload multiple files",
				Command:     "sdpctl appliance files upload <path1> <path2>",
			},
			{
				Description: "rename a file when uploading",
				Command:     "sdpctl appliance files upload <path-to-file>=<new-file-name>",
			},
		},
	}
)
View Source
var (
	LicenseRootDoc = CommandDoc{
		Short: "Manage assigned User/Portal/Service licenses",
		Long:  ``,
	}

	LicensePruneDoc = CommandDoc{
		Short: "clear the license back (from 30) to 1 day",
		Long: `clear the license back (from 30) to 1 day
This command only works on appliances higher or equal to 6.1 (API Version 18)`,
		Examples: []ExampleDoc{
			{
				Description: "",
				Command:     "sdpctl license prune",
			},
		},
	}
)
View Source
var (
	MaintenanceModeLongDescription = `` /* 270-byte string literal not displayed */

	MaintenanceRootDoc = CommandDoc{
		Short: "Manually manage maintenance mode on Controllers",
		Long:  ``,
	}

	MaintenanceStatusDoc = CommandDoc{
		Short: "View maintenance status of appliances",
	}

	MaintenanceDisable = CommandDoc{
		Short: "Disable maintenance mode on a single Controller",
		Long:  MaintenanceModeLongDescription,

		Examples: []ExampleDoc{
			{
				Description: "Disable maintenance mode on a fixed Controller UUID",
				Command:     "sdpctl appliance maintenance disable 20e75a08-96c6-4ea3-833e-cdbac346e2ae",
				Output:      "Change result: success\nChange Status: completed",
			},

			{
				Description: "Disable maintenance mode interactive prompt",
				Command:     "sdpctl appliance maintenance disable",
				Output: `
? select appliance: Controller-two - Default Site - []

A Controller in maintenance mode will not accept any API calls besides disabling maintenance mode. Starting in version 6.0, clients will still function as usual while a Controller is in maintenance mode.

? Are you really sure you want to disable maintenance mode on Controller-two?

Do you want to continue? Yes
Change result: success
Change Status: completed
                `,
			},
		},
	}

	MaintenanceEnable = CommandDoc{
		Short: "Enable maintenance mode on a single Controller",
		Long:  MaintenanceModeLongDescription,

		Examples: []ExampleDoc{
			{
				Description: "Toggle maintenance mode to false on a fixed Controller UUID",
				Command:     "sdpctl appliance maintenance enable 20e75a08-96c6-4ea3-833e-cdbac346e2ae",
				Output:      "Change result: success\nChange Status: completed",
			},

			{
				Description: "Enable maintenance mode interactive prompt",
				Command:     "sdpctl appliance maintenance enable",
				Output: `
? select appliance: Controller-two - Default Site - []

This is a superuser function and should only be used if you know what you are doing.

? Are you really sure you want to enable maintenance mode on Controller-two?

Do you want to continue? Yes
Change result: success
Change Status: completed
                `,
			},
		},
	}
)
View Source
var (
	ProfileRootDoc = CommandDoc{
		Short: "Manage configuration for multiple admin profiles",
		Long:  `Manage the local configuration of sdpctl for multiple admin profiles`,
	}
	ProfileAddDoc = CommandDoc{
		Short: "Add another admin profile configuration",
		Long:  `Add creates a new admin profile configuration directory`,
	}
	ProfileDeleteDoc = CommandDoc{
		Short: "Remove an existing admin profile",
		Long:  `Remove an existing admin profile from your local configuration`,
	}
	ProfileListDoc = CommandDoc{
		Short: "List all existing admin profiles",
		Long:  ``,
	}
	ProfileSetDoc = CommandDoc{
		Short: "Set which admin profile to use",
		Long:  ``,

		Examples: []ExampleDoc{
			{
				Description: "Set admin profile without any arguments",
				Command:     "sdpctl profile set",
				Output: `? select profile:  [Use arrows to move, type to filter]
❯ production
  staging
  testing`,
			},
			{
				Description: "set production as your current admin profile",
				Command:     "sdpctl profile set production",
			},
		},
	}
)
View Source
var (
	ServiceUsersRoot = &CommandDoc{
		Short:    "Manage Service Users",
		Long:     "",
		Examples: []ExampleDoc{},
	}
	ServiceUsersList = &CommandDoc{
		Short: "List service users in the Collective",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Description: "list service users",
				Command:     "sdpctl service-users list",
			},
			{
				Description: "output in JSON format",
				Command:     "sdpctl service-users list --json",
			},
		},
	}
	ServiceUsersGet = &CommandDoc{
		Short: "Get detailed information about a service user",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Description: "get user with id of <id>",
				Command:     "sdpctl service-users get <id>",
			},
		},
	}
	ServiceUsersCreate = &CommandDoc{
		Short: "Create a new service user",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Description: "create a new service user",
				Command:     "sdpctl service-users create",
				Output: `? Name for service user: <service-user-name>
? Passphrase for service user: <service-user-passphrase>
? Confirm your passphrase: <confirm-passphrase>`,
			},
			{
				Description: "create service user with flag input",
				Command:     `echo "<passphrase>" | sdpctl service-users create --name=<service-user-name>`,
			},
			{
				Description: "create a service user from a valid JSON file",
				Command:     "sdpctl service-users create --from-file=<path-to-json-file>",
			},
		},
	}
	ServiceUsersUpdate = &CommandDoc{
		Short: "Update a service user",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Description: "update the name of a service user with the id of <id>",
				Command:     "sdpctl service-users update <id> name <new-name>",
			},
			{
				Description: "set a new passphrase for service user with id of <id>",
				Command:     "sdpctl service-users update <id> passphrase <new-passphrase>",
			},
			{
				Description: "disable a service user with id of <id>",
				Command:     "sdpctl service-users update <id> disable",
			},
			{
				Description: "enable a service user with id of <id>",
				Command:     "sdpctl service-users update <id> enable",
			},
			{
				Description: "add a tag for a service user",
				Command:     "sdpctl service-users update <id> add tag <new-tag>",
			},
			{
				Description: "add a label for a service user",
				Command:     "sdpctl service-users update <id> add label <key>=<value>",
			},
			{
				Description: "remove a tag for a service user",
				Command:     "sdpctl service-users update <id> remove tag <tag>",
			},
			{
				Description: "remove a label for a service user",
				Command:     "sdpctl service-users update <id> remove label <key>",
			},
			{
				Description: "update a service user using a predefined JSON file",
				Command:     "sdpctl service-users update <id> --from-file=<path-to-json-file>",
			},
			{
				Description: "update multiple values of a service user",
				Command:     `sdpctl service-users update <id> '{"name": "<new-name>", "disabled": true}'`,
			},
		},
	}
	ServiceUsersDelete = &CommandDoc{
		Short: "Delete one or more service user(s)",
		Long:  "",
		Examples: []ExampleDoc{
			{
				Description: "delete a service user with the id of <id>",
				Command:     "sdpctl service-users delete <id>",
			},
			{
				Description: "delete multiple service users by providing multiple id:s",
				Command:     "sdpctl service-users delete <id1> <id2>",
			},
			{
				Description: "delete service user(s) using prompt",
				Command:     "sdpctl service-users delete",
			},
		},
	}
)
View Source
var (
	SitesDocRoot = CommandDoc{
		Short:    "Root command for listing and checking status of sites in a collective",
		Examples: []ExampleDoc{},
	}
	SitesListDocs = CommandDoc{
		Short: "List and see status of sites of a collective",
		Long: `List and see status of sites of a collective. By default, configured sites will be shown in a table, but viewing sites in json format is supported using the '--json' flag.
Text lines that contain multiple lines will be abbreviated to only showing the first line in the table view. In that case, the abbreviated lines will be indicated with '[...]'.
To view the full output, use the '--json' flag.`,
		Examples: []ExampleDoc{
			{
				Command:     "sdpctl sites list",
				Description: "will list all sites configured in a collective if no arguments are used.",
				Output: `Site Name       Short Name    ID                                      Tags         Description    Status
---------       ----------    --                                      ----         -----------    ------
Default Site                  8a4add9e-0e99-4bb1-949c-c9faf9a49ad4    [builtin]                   healthy`,
			},
			{
				Command:     "sdpctl sites list --json",
				Description: "list sites with json output",
			},
		},
	}
	SitesResourcesDocsRoot = CommandDoc{
		Short:    "Command for resources",
		Long:     "",
		Examples: []ExampleDoc{},
	}
	SitesResourcesDocsList = CommandDoc{
		Short:    "Command for listing resources",
		Long:     "",
		Examples: []ExampleDoc{},
	}
)
View Source
var (
	TokenDoc = CommandDoc{
		Short: "Perform actions on Admin, Claims and Entitlement tokens",
		Long:  `The token command allows you to renew or revoke tokens used in the Collective.`,
	}
	TokenListDoc = CommandDoc{
		Short: "List distinguished names of active devices",
		Long:  "List distinguished names of active tokens, either in table format or JSON format using the '--json' flag",
		Examples: []ExampleDoc{
			{
				Description: "default list command",
				Command:     "sdpctl token list",
			},
			{
				Description: "print list in JSON format",
				Command:     "sdpctl token list --json",
			},
		},
	}
	TokenRevokeDoc = CommandDoc{
		Short: "Revoke entitlement tokens by distinguished name or token-type",
		Long: `Revoke tokens by distinguished name or token type.

Valid token types are:
  - administration
  - adminclaims
  - entitlements
  - claims`,
		Examples: []ExampleDoc{
			{
				Description: "revoke by distinguished name",
				Command:     "sdpctl token revoke <distinguished-name>",
			},
			{
				Description: "revoke by token type",
				Command:     "sdpctl token revoke --token-type=claims",
			},
		},
	}
)
View Source
var (
	AdminMessagesRootDoc = CommandDoc{
		Short: "List of all Admin Messages generated by the system",
	}
)
View Source
var (
	CompletionDocs = CommandDoc{
		Short: "Generate shell completion scripts",
		Long:  `sdpctl provides a way to generate autocompletion scripts for your current shell. See examples for more details on your specific shell.`,
		Examples: []ExampleDoc{
			{
				Description: `Bash:
Note that if you installed sdpctl from deb or rpm package, bash completion is already included.`,
				Command: `mkdir -p ~/.local/share/bash-completion
sdpctl completion bash | tee ~/.local/share/bash-completion/sdpctl`,
			},
			{
				Description: `ZSH:
If shell completion is not already enabled in your environment,
you will need to enable it.  You can execute the following once:`,
				Command: `echo "autoload -U compinit; compinit" >> ~/.zshrc`,
			},
			{
				Description: "To load completions for each session, execute once:",
				Command:     `sdpctl completion zsh | tee --output-error=exit "/usr/share/zsh/vendor-completions/_sdpctl"`,
			},
			{
				Description: `Fish:
Load completion for the session:`,
				Command: "sdpctl completion fish | source",
			},
			{
				Description: "To load completions for each session, execute once:",
				Command:     "sdpctl completion fish | tee ~/.config/fish/completions/sdpctl.fish",
			},
			{
				Description: `PowerShell:
Load completion for the session`,
				Command: "sdpctl completion powershell | Out-String | Invoke-Expression",
			},
			{
				Description: `To load completions for every new session, run this command
and source this file from your PowerShell profile.`,
				Command: "sdpctl completion powershell > sdpctl.ps1",
			},
			{
				Description: `MacOS:
Load completion for session`,
				Command: "sdpctl completion bash | tee /usr/local/etc/bash_completion.d/sdpctl",
			},
		},
	}
)
View Source
var (
	PrivilegesDocs = CommandDoc{
		Short: "show your current user privileges",
	}
)

Functions

This section is empty.

Types

type CommandDoc

type CommandDoc struct {
	Long     string
	Short    string
	Examples []ExampleDoc
}

func (*CommandDoc) ExampleString

func (c *CommandDoc) ExampleString() string

ExampleString generates a single string from multiple entries of ExampleDoc for printing in the command specifications

type ExampleDoc

type ExampleDoc struct {
	Description string
	Command     string
	Output      string
}

func (*ExampleDoc) String

func (e *ExampleDoc) String() string

String formats each example to a single string and returns

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL