@robinmordasiewicz/f5xc-xcsh 1.0.82-2512312116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,206 @@
1
+ # xcsh
2
+
3
+ F5 Distributed Cloud Shell - A command-line interface for managing F5 Distributed Cloud resources.
4
+
5
+ ## Documentation
6
+
7
+ Full documentation is available at **[robinmordasiewicz.github.io/f5xc-xcsh](https://robinmordasiewicz.github.io/f5xc-xcsh)**
8
+
9
+ ## Installation
10
+
11
+ ### Homebrew
12
+
13
+ ```bash
14
+ brew tap robinmordasiewicz/tap
15
+ brew install --cask xcsh
16
+ ```
17
+
18
+ ### Install Script
19
+
20
+ ```bash
21
+ curl -fsSL https://raw.githubusercontent.com/robinmordasiewicz/f5xc-xcsh/main/install.sh | sh
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ### Basic Command Structure
27
+
28
+ The CLI is organized around **domains** matching F5 Distributed Cloud API structure:
29
+
30
+ ```bash
31
+ xcsh <domain> <operation> <resource-type> [resource-name] [flags]
32
+ ```
33
+
34
+ ### Domain-Based Commands
35
+
36
+ Common domains include:
37
+
38
+ | Domain | Alias | Purpose |
39
+ |--------|-------|---------|
40
+ | `load_balancer` | `lb` | Load balancing and origin pools |
41
+ | `infrastructure` | `infra` | Core infrastructure resources |
42
+ | `security` | `sec` | WAF, DDoS, bot defense |
43
+ | `networking` | `net` | Network routing and configuration |
44
+ | `observability` | `obs`, `o11y` | Monitoring and observability |
45
+ | `api_security` | `apisec` | API protection and security |
46
+ | `identity` | `iam` | Identity and access management |
47
+
48
+ ### Examples
49
+
50
+ #### List Resources
51
+
52
+ ```bash
53
+ # List HTTP load balancers in default namespace
54
+ xcsh load_balancer list http_loadbalancer
55
+
56
+ # Using alias for shorter command
57
+ xcsh lb list http_loadbalancer
58
+
59
+ # List in specific namespace
60
+ xcsh lb list http_loadbalancer -n production
61
+ ```
62
+
63
+ #### Get a Specific Resource
64
+
65
+ ```bash
66
+ # Get a load balancer configuration
67
+ xcsh load_balancer get http_loadbalancer example-lb
68
+
69
+ # Get from specific namespace
70
+ xcsh lb get http_loadbalancer example-lb -n production
71
+ ```
72
+
73
+ #### Create a Resource
74
+
75
+ ```bash
76
+ # Create from YAML file
77
+ xcsh load_balancer create http_loadbalancer -i lb-config.yaml
78
+
79
+ # Create from inline JSON
80
+ xcsh lb create origin_pool --json-data '{"metadata":{"name":"example-pool"},...}'
81
+ ```
82
+
83
+ #### Delete a Resource
84
+
85
+ ```bash
86
+ # Delete with confirmation
87
+ xcsh load_balancer delete http_loadbalancer example-lb
88
+
89
+ # Delete without confirmation (for scripts)
90
+ xcsh lb delete http_loadbalancer example-lb --yes
91
+ ```
92
+
93
+ #### Apply (Create or Update)
94
+
95
+ ```bash
96
+ # Apply from YAML (creates if not exists, updates if does)
97
+ xcsh load_balancer apply http_loadbalancer -i lb-config.yaml
98
+ ```
99
+
100
+ #### Get Help
101
+
102
+ ```bash
103
+ # Show available domains
104
+ xcsh --help
105
+
106
+ # Show domain-specific operations
107
+ xcsh load_balancer --help
108
+
109
+ # Show operation-specific help
110
+ xcsh load_balancer list --help
111
+
112
+ # Show resource-type help
113
+ xcsh load_balancer list http_loadbalancer --help
114
+ ```
115
+
116
+ ## Development & Domain System
117
+
118
+ ### Automated Domain Synchronization
119
+
120
+ xcsh uses an **automated CI/CD-driven system** to keep domain definitions synchronized with upstream F5 Distributed Cloud API changes. This ensures the CLI always reflects the latest API structure without manual intervention.
121
+
122
+ #### How It Works
123
+
124
+ 1. **Daily Checks**: GitHub Actions workflow (`sync-upstream-specs.yml`) checks for new upstream spec versions daily at 6 AM UTC
125
+ 2. **Automatic Regeneration**: When updates are detected, the system:
126
+ - Downloads latest enriched API specifications
127
+ - Regenerates domain and resource registries
128
+ - Validates code quality and tests pass
129
+ - Creates a pull request with all changes
130
+ 3. **Idempotent Generation**: Code generation is deterministic - running it twice with identical inputs produces byte-for-byte identical output
131
+ 4. **CI/CD Validation**: Every commit validates that generated files match upstream specs and are reproducible
132
+
133
+ #### Domain Registry
134
+
135
+ The domain registry (`pkg/types/domains_generated.go`) is **automatically generated** from upstream API specifications (``.specs/index.json`). It currently contains **40 domains** organized by functional area:
136
+
137
+ - **Infrastructure**: cloud_infrastructure, site, site_management, container_services
138
+ - **Security**: waf, bot_and_threat_defense, network_security
139
+ - **Networking**: network, dns, network_connectivity, vpn
140
+ - **Observability**: observability_and_analytics, telemetry_and_insights, statistics
141
+ - **Identity**: identity, user_and_account_management, users
142
+ - **And 24 more...**
143
+
144
+ #### Manual Domain Configuration
145
+
146
+ Team-specific domain customization is managed in `.specs/domain_config.yaml`:
147
+
148
+ ```yaml
149
+ # Domain aliases (short command shortcuts)
150
+ aliases:
151
+ load_balancer: [lb]
152
+ security: [sec]
153
+ networking: [net]
154
+ infrastructure: [infra]
155
+
156
+ # Deprecated domains with migration guidance
157
+ deprecated_domains:
158
+ config:
159
+ maps_to: system
160
+ reason: "Configuration management merged into system domain"
161
+ deprecated_since: "v1.0.25"
162
+
163
+ # Missing metadata requiring upstream attention
164
+ missing_metadata:
165
+ - domain: api_security
166
+ missing_field: "is_preview"
167
+ reason: "Need to mark preview/beta domains"
168
+ ```
169
+
170
+ This file is **version-controlled** and survives automated spec updates, allowing teams to maintain consistent domain aliases across releases.
171
+
172
+ #### For Developers
173
+
174
+ To regenerate domain definitions:
175
+
176
+ ```bash
177
+ # Full generation pipeline
178
+ make generate
179
+
180
+ # Just regenerate domains
181
+ make generate-domains
182
+
183
+ # Verify idempotency (CI safety check)
184
+ make ci-generate
185
+ ```
186
+
187
+ The generation pipeline:
188
+
189
+ 1. Downloads latest specs via `scripts/download-specs.sh`
190
+ 2. Runs `scripts/generate-domains.go` to create domain registry
191
+ 3. Runs `scripts/generate-schemas.go` to create resource schemas
192
+ 4. Validates against `scripts/validate-specs.go`
193
+
194
+ #### Upstream Spec Quality
195
+
196
+ When spec organization issues are detected, the system can automatically report them to the upstream repository. Use the GitHub issue template to report specification problems:
197
+
198
+ - Missing metadata fields
199
+ - Resource classification issues
200
+ - Domain organization concerns
201
+
202
+ See `.github/ISSUE_TEMPLATE/upstream-spec-quality.md` for the standardized reporting format.
203
+
204
+ ## License
205
+
206
+ This project is open source. See the LICENSE file for details.
@@ -0,0 +1,241 @@
1
+ #compdef xcsh
2
+ # zsh completion for xcsh
3
+ # Generated by xcsh completion zsh
4
+
5
+ _xcsh() {
6
+ local curcontext="$curcontext" state line
7
+ typeset -A opt_args
8
+
9
+ local -a global_opts
10
+ global_opts=(
11
+ '(-h --help)'{-h,--help}'[Show help information]'
12
+ '(-v --version)'{-v,--version}'[Show version number]'
13
+ '--no-color[Disable color output]'
14
+ '(-o --output)'{-o,--output}'[Output format]:format:(json yaml table)'
15
+ '(-ns --namespace)'{-ns,--namespace}'[Namespace]:namespace:_xcsh_namespaces'
16
+ '--spec[Output command specification as JSON for AI assistants]'
17
+ )
18
+
19
+ _arguments -C \
20
+ "${global_opts[@]}" \
21
+ '1: :->domain' \
22
+ '2: :->action' \
23
+ '*: :->args'
24
+
25
+ case $state in
26
+ (domain)
27
+ local -a domains builtins
28
+ domains=(
29
+ 'admin_console_and_ui:Manage static UI components for admin console.'
30
+ 'api:Discover, catalog, and test service interfaces.'
31
+ 'authentication:Authentication API'
32
+ 'bigip:Manage iRules, data groups, and virtual servers.'
33
+ 'billing_and_usage:Manage subscription plans and payment methods.'
34
+ 'blindfold:Manage secret encryption and policy rules.'
35
+ 'bot_and_threat_defense:Detect and block automated attacks.'
36
+ 'cdn:Configure caching rules and load balancing.'
37
+ 'ce_management:Manage Customer Edge sites and network interfaces.'
38
+ 'certificates:Manage SSL/TLS certificate chains and trusted CAs.'
39
+ 'cloud_infrastructure:Connect and manage multi-cloud providers.'
40
+ 'cloudstatus:F5 XC service status and incidents'
41
+ 'completion:Shell completion script generation'
42
+ 'container_services:Deploy containerized workloads across sites.'
43
+ 'data_and_privacy_security:Configure sensitive data detection and privacy policies.'
44
+ 'data_intelligence:Data Intelligence API'
45
+ 'ddos:Configure blocking policies and tunnel protection.'
46
+ 'dns:Manage zones, records, and load balancing.'
47
+ 'generative_ai:Access AI assistant queries and feedback.'
48
+ 'login:Authentication and session management'
49
+ 'managed_kubernetes:Configure Kubernetes RBAC and pod security policies.'
50
+ 'marketplace:Manage third-party integrations and add-ons.'
51
+ 'network:Configure BGP routing, tunnels, and connectivity.'
52
+ 'network_security:Configure firewalls, NAT, and routing policies.'
53
+ 'nginx_one:Configure NGINX proxy instances and deployments.'
54
+ 'object_storage:Manage stored objects and bucket versioning.'
55
+ 'observability:Configure synthetic monitors and health checks.'
56
+ 'rate_limiting:Configure traffic throttling and policer rules.'
57
+ 'secops_and_incident_response:Configure automated threat mitigation rules.'
58
+ 'service_mesh:Configure application types and discovery.'
59
+ 'shape:Configure bot defense and threat prevention.'
60
+ 'sites:Deploy edge nodes across cloud providers.'
61
+ 'statistics:Monitor alerts, logs, and flow analytics.'
62
+ 'support:Create and track customer tickets.'
63
+ 'telemetry_and_insights:Telemetry And Insights API'
64
+ 'tenant_and_identity:Manage user profiles and session controls.'
65
+ 'threat_campaign:Threat Campaign API'
66
+ 'users:Manage account tokens and label settings.'
67
+ 'virtual:Configure load balancers and origin pools.'
68
+ 'vpm_and_node_management:Vpm And Node Management API'
69
+ 'waf:Configure application firewall rules and bot protection.'
70
+ 'console-ui:Alias for admin_console_and_ui'
71
+ 'ui-assets:Alias for admin_console_and_ui'
72
+ 'static-components:Alias for admin_console_and_ui'
73
+ 'apisec:Alias for api'
74
+ 'api-discovery:Alias for api'
75
+ 'authn:Alias for authentication'
76
+ 'oidc:Alias for authentication'
77
+ 'sso:Alias for authentication'
78
+ 'f5-bigip:Alias for bigip'
79
+ 'irule:Alias for bigip'
80
+ 'ltm:Alias for bigip'
81
+ 'billing-usage:Alias for billing_and_usage'
82
+ 'quotas:Alias for billing_and_usage'
83
+ 'usage-tracking:Alias for billing_and_usage'
84
+ 'bf:Alias for blindfold'
85
+ 'encrypt:Alias for blindfold'
86
+ 'secrets:Alias for blindfold'
87
+ 'threat-defense:Alias for bot_and_threat_defense'
88
+ 'tpm:Alias for bot_and_threat_defense'
89
+ 'shape-bot:Alias for bot_and_threat_defense'
90
+ 'cache:Alias for cdn'
91
+ 'content:Alias for cdn'
92
+ 'ce-mgmt:Alias for ce_management'
93
+ 'edge-management:Alias for ce_management'
94
+ 'ce-lifecycle:Alias for ce_management'
95
+ 'cert:Alias for certificates'
96
+ 'certs:Alias for certificates'
97
+ 'ssl:Alias for certificates'
98
+ 'tls:Alias for certificates'
99
+ 'cloud:Alias for cloud_infrastructure'
100
+ 'infra:Alias for cloud_infrastructure'
101
+ 'provider:Alias for cloud_infrastructure'
102
+ 'vk8s:Alias for container_services'
103
+ 'containers:Alias for container_services'
104
+ 'workloads:Alias for container_services'
105
+ 'data-privacy:Alias for data_and_privacy_security'
106
+ 'pii:Alias for data_and_privacy_security'
107
+ 'sensitive-data:Alias for data_and_privacy_security'
108
+ 'lma:Alias for data_and_privacy_security'
109
+ 'di:Alias for data_intelligence'
110
+ 'intelligence:Alias for data_intelligence'
111
+ 'insights:Alias for data_intelligence'
112
+ 'dos:Alias for ddos'
113
+ 'ddos-protect:Alias for ddos'
114
+ 'dns-zone:Alias for dns'
115
+ 'zones:Alias for dns'
116
+ 'ai:Alias for generative_ai'
117
+ 'genai:Alias for generative_ai'
118
+ 'assistant:Alias for generative_ai'
119
+ 'mk8s:Alias for managed_kubernetes'
120
+ 'appstack:Alias for managed_kubernetes'
121
+ 'k8s-mgmt:Alias for managed_kubernetes'
122
+ 'market:Alias for marketplace'
123
+ 'addons:Alias for marketplace'
124
+ 'extensions:Alias for marketplace'
125
+ 'net:Alias for network'
126
+ 'routing:Alias for network'
127
+ 'bgp:Alias for network'
128
+ 'netsec:Alias for network_security'
129
+ 'nfw:Alias for network_security'
130
+ 'nginx:Alias for nginx_one'
131
+ 'nms:Alias for nginx_one'
132
+ 'nginx-plus:Alias for nginx_one'
133
+ 'storage:Alias for object_storage'
134
+ 's3:Alias for object_storage'
135
+ 'buckets:Alias for object_storage'
136
+ 'obs:Alias for observability'
137
+ 'monitoring:Alias for observability'
138
+ 'synth:Alias for observability'
139
+ 'ratelimit:Alias for rate_limiting'
140
+ 'throttle:Alias for rate_limiting'
141
+ 'policer:Alias for rate_limiting'
142
+ 'secops:Alias for secops_and_incident_response'
143
+ 'incident-response:Alias for secops_and_incident_response'
144
+ 'mitigation:Alias for secops_and_incident_response'
145
+ 'mesh:Alias for service_mesh'
146
+ 'svc-mesh:Alias for service_mesh'
147
+ 'shape-sec:Alias for shape'
148
+ 'safeap:Alias for shape'
149
+ 'site:Alias for sites'
150
+ 'deployment:Alias for sites'
151
+ 'stats:Alias for statistics'
152
+ 'metrics:Alias for statistics'
153
+ 'logs:Alias for statistics'
154
+ 'tickets:Alias for support'
155
+ 'help-desk:Alias for support'
156
+ 'telemetry:Alias for telemetry_and_insights'
157
+ 'ti:Alias for telemetry_and_insights'
158
+ 'tenant-identity:Alias for tenant_and_identity'
159
+ 'idm:Alias for tenant_and_identity'
160
+ 'user-settings:Alias for tenant_and_identity'
161
+ 'threats:Alias for threat_campaign'
162
+ 'campaigns:Alias for threat_campaign'
163
+ 'threat-intel:Alias for threat_campaign'
164
+ 'user:Alias for users'
165
+ 'accounts:Alias for users'
166
+ 'iam:Alias for users'
167
+ 'lb:Alias for virtual'
168
+ 'loadbalancer:Alias for virtual'
169
+ 'vhost:Alias for virtual'
170
+ 'vpm:Alias for vpm_and_node_management'
171
+ 'nodes:Alias for vpm_and_node_management'
172
+ 'node-mgmt:Alias for vpm_and_node_management'
173
+ 'firewall:Alias for waf'
174
+ 'appfw:Alias for waf'
175
+ )
176
+ builtins=(
177
+ 'help:Show help information'
178
+ 'quit:Exit the shell'
179
+ 'exit:Exit the shell'
180
+ 'clear:Clear the screen'
181
+ 'history:Show command history'
182
+ 'context:Show current navigation context'
183
+ 'ctx:Show current navigation context'
184
+ )
185
+ _describe -t domains 'domain' domains
186
+ _describe -t builtins 'builtin' builtins
187
+ ;;
188
+ (action)
189
+ case ${line[1]} in
190
+ (cloudstatus)
191
+ _values 'command' 'status:Get overall cloud status indicator' 'summary:Get complete status summary' 'components:List all components and status' 'incidents:List active and recent incidents' 'maintenance:List scheduled maintenance windows'
192
+ ;;
193
+ (completion)
194
+ _values 'command' 'bash:Generate bash completion script' 'zsh:Generate zsh completion script' 'fish:Generate fish completion script'
195
+ ;;
196
+ (login)
197
+ _values 'command' 'banner:Display xcsh banner with logo' 'profile:Manage saved connection profiles' 'context:Manage default namespace context'
198
+ ;;
199
+ (help|quit|exit|clear|history|context|ctx)
200
+ ;;
201
+ (*)
202
+ local -a actions
203
+ actions=(
204
+ 'list:List resources'
205
+ 'get:Get a specific resource'
206
+ 'create:Create a new resource'
207
+ 'delete:Delete a resource'
208
+ 'replace:Replace a resource'
209
+ 'apply:Apply configuration from file'
210
+ 'status:Get resource status'
211
+ 'patch:Patch a resource'
212
+ 'add-labels:Add labels to a resource'
213
+ 'remove-labels:Remove labels from a resource'
214
+ )
215
+ _describe -t actions 'action' actions
216
+ ;;
217
+ esac
218
+ ;;
219
+ (args)
220
+ local -a action_opts
221
+ action_opts=(
222
+ '(-n --name)'{-n,--name}'[Resource name]:name:'
223
+ '(-ns --namespace)'{-ns,--namespace}'[Namespace]:namespace:_xcsh_namespaces'
224
+ '(-o --output)'{-o,--output}'[Output format]:format:(json yaml table)'
225
+ '--limit[Maximum results]:limit:'
226
+ '--label[Filter by label]:label:'
227
+ '(-f --file)'{-f,--file}'[Configuration file]:file:_files'
228
+ '--spec[Output command specification as JSON for AI assistants]'
229
+ )
230
+ _arguments "${action_opts[@]}"
231
+ ;;
232
+ esac
233
+ }
234
+
235
+ _xcsh_namespaces() {
236
+ local -a namespaces
237
+ namespaces=('default' 'system' 'shared')
238
+ _describe -t namespaces 'namespace' namespaces
239
+ }
240
+
241
+ _xcsh "$@"
@@ -0,0 +1,70 @@
1
+ # bash completion for xcsh
2
+ # Generated by xcsh completion bash
3
+ # shellcheck disable=SC2034,SC2207
4
+
5
+ _xcsh_completions() {
6
+ local cur prev words cword
7
+ _init_completion || return
8
+
9
+ local commands="admin_console_and_ui api authentication bigip billing_and_usage blindfold bot_and_threat_defense cdn ce_management certificates cloud_infrastructure cloudstatus completion container_services data_and_privacy_security data_intelligence ddos dns generative_ai login managed_kubernetes marketplace network network_security nginx_one object_storage observability rate_limiting secops_and_incident_response service_mesh shape sites statistics support telemetry_and_insights tenant_and_identity threat_campaign users virtual vpm_and_node_management waf console-ui ui-assets static-components apisec api-discovery authn oidc sso f5-bigip irule ltm billing-usage quotas usage-tracking bf encrypt secrets threat-defense tpm shape-bot cache content ce-mgmt edge-management ce-lifecycle cert certs ssl tls cloud infra provider vk8s containers workloads data-privacy pii sensitive-data lma di intelligence insights dos ddos-protect dns-zone zones ai genai assistant mk8s appstack k8s-mgmt market addons extensions net routing bgp netsec nfw nginx nms nginx-plus storage s3 buckets obs monitoring synth ratelimit throttle policer secops incident-response mitigation mesh svc-mesh shape-sec safeap site deployment stats metrics logs tickets help-desk telemetry ti tenant-identity idm user-settings threats campaigns threat-intel user accounts iam lb loadbalancer vhost vpm nodes node-mgmt firewall appfw help quit exit clear history"
10
+ local actions="list get create delete replace apply status patch add-labels remove-labels"
11
+ local builtins="help quit exit clear history context ctx"
12
+ local global_flags="--help -h --version -v --no-color --output -o --namespace -ns --spec"
13
+
14
+ # Handle completion based on position
15
+ case ${cword} in
16
+ 1)
17
+ # First word: domains, builtins, or flags
18
+ if [[ "${cur}" == -* ]]; then
19
+ COMPREPLY=($(compgen -W "${global_flags}" -- "${cur}"))
20
+ else
21
+ COMPREPLY=($(compgen -W "${commands} ${builtins}" -- "${cur}"))
22
+ fi
23
+ return 0
24
+ ;;
25
+ 2)
26
+ # Second word: actions or subcommands based on first word
27
+ local domain="${words[1]}"
28
+ case "${domain}" in
29
+ cloudstatus)
30
+ COMPREPLY=($(compgen -W "status summary components incidents maintenance" -- "${cur}"))
31
+ return 0
32
+ ;;
33
+ completion)
34
+ COMPREPLY=($(compgen -W "bash zsh fish" -- "${cur}"))
35
+ return 0
36
+ ;;
37
+ login)
38
+ COMPREPLY=($(compgen -W "banner profile context" -- "${cur}"))
39
+ return 0
40
+ ;;
41
+ login/profile)
42
+ COMPREPLY=($(compgen -W "list show create use delete" -- "${cur}"))
43
+ return 0
44
+ ;;
45
+ login/context)
46
+ COMPREPLY=($(compgen -W "show set list" -- "${cur}"))
47
+ return 0
48
+ ;;
49
+ help | quit | exit | clear | history | context | ctx)
50
+ return 0
51
+ ;;
52
+ *)
53
+ # API domain - suggest actions
54
+ COMPREPLY=($(compgen -W "${actions}" -- "${cur}"))
55
+ return 0
56
+ ;;
57
+ esac
58
+ ;;
59
+ *)
60
+ # Third+ word: flags
61
+ if [[ "${cur}" == -* ]]; then
62
+ local action_flags="--name -n --namespace -ns --output -o --json --yaml --limit --label --spec"
63
+ COMPREPLY=($(compgen -W "${action_flags}" -- "${cur}"))
64
+ fi
65
+ return 0
66
+ ;;
67
+ esac
68
+ }
69
+
70
+ complete -F _xcsh_completions xcsh