Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created April 20, 2022 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ajnasz/aea2bb05f469e17acd699df8e8797cd6 to your computer and use it in GitHub Desktop.
Save Ajnasz/aea2bb05f469e17acd699df8e8797cd6 to your computer and use it in GitHub Desktop.
#compdef meta
#autoload
local -a _meta_commands
_meta_commands=(
'info:General Information'
'onboard:Onboard a user device locally or using a Single Sign-on (SSO) method.'
'ssp:Perform actions available from the Proofpoint self-service portal (SSP).'
'profile:Manage Proofpoint Agent user profiles'
'connect:Connect to the Proofpoint NaaS with the selected device profile'
'disconnect:Disconnect currently connected profile from the Proofpoint NaaS'
'status:Display a detailed status of a connection to Proofpoint NaaS'
'monitor:Monitor the agent status'
'creds:Manage user profile credentials'
'posture:View the existing posture checks and test SQL queries'
'device_settings:Manage various user device settings'
'trusted_networks:View trusted networks defined for the user profiles'
'direct_easylinks:View direct EasyLinks networks defined for the user profile'
'logs:Manage Proofpoint Agent Console event log'
'captive_portal_check:Enable or disable checking for presence of a captive portal'
'appearance:View device appearance settings'
'proxy:Proxy related settings (experimental)'
'debug:Debug information'
'notification:Manage notifications'
'license:Manage license'
)
_meta_connect_args() {
_arguments \
'(-h --help)'{-h,--help}'[Show this help message and exit]' \
'(--uuid)--uuid[Profile UUID (optional)]:uuid:' \
'(--protocol)--protocol[Protocol (optional)]:protocol:(IPSEC OPENVPN AUTO)' \
'(--remote-host)--remote-host[Override profile remote host (optional)]:remotehost:' \
'(--persistent)--persistent[Persist across restarts (optional)]' \
'(--http-proxy)--http-proxy[HTTP proxy <HOST:PORT>]:httpproxy:' \
'(--unsuspend_connection)--unsuspend_connection[Reset the suspend connection flag (optional)]' \
&& return 0
}
_meta_help_only_args() {
_arguments \
'(-h --help)'{-h,--help}'[Show this help message and exit]' \
&& return 0
}
_meta_json_and_help_args() {
_arguments \
'(-h --help)'{-h,--help}'[Show this help message and exit]' \
'(-j --json)'{-j,--json}'[Output in JSON format]' \
&& return 0
}
_meta_onboard_args() {
_arguments \
'(-h --help)'{-h,--help}'[show this help message and exit]' \
'(--zone)--zone[Zone (optional)]:ZONE' \
'(-n --neid)'{-n,--neid}'[Renew Network Element]:NEID' \
'(-w --filename)'{-w,--filename}'[Save to local file instead of installing]:FILENAME:_files' \
'(-j --json)'{-j,--json}'[Output in JSON format]' \
'(--no-pkce)--no-pkce[Avoid using Proof Key Code Exchange (RFC 7636)]' \
'(--native-service)--native-service[Onboard a Native Service participant]' \
'(--on-behalf-of)--on-behalf-of[Onboard on behalf of a user (email)]:ON_BEHALF_OF' \
'(--username)--username[Username. Required for non SSO]:USERNAME' \
'(--password)--password[Password. Required for non SSO]:PASSWORD' \
'(--sso)--sso[Use single-sign-on]' \
'(--headless)--headless[Headless SSO login]' \
'(--api-key-id)--api-key-id[API Key ID. Alternatively, use the PROOFPOINT_AGENT_API_KEY_ID environment variable]:API_KEY_ID ' \
'(--api-key-secret)--api-key-secret[API Key secret. Alternatively, use the PROOFPOINT_AGENT_API_KEY_SECRET environment variable]:API_KEY_SECRET' \
&& return 0
}
_meta_status_args() {
_meta_json_and_help_args
}
_meta_disconnect_args() {
_meta_help_only_args
}
_meta_subcommand() {
case "$words[1]" in
connect)
_meta_connect_args
;;
disconnect)
_meta_help_only_args
;;
info)
_meta_info_args
;;
status)
_meta_status_args
;;
onboard)
_meta_onboard_args
;;
esac
}
_arguments -C '*:: :->subcmds'
if (( CURRENT == 1 ))
then
_describe -t commands "meta subcommand" _meta_commands
return
fi
_meta_subcommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment