ans-group / cli Goto Github PK
View Code? Open in Web Editor NEWCommand line utility for accessing ANS services/APIs
License: MIT License
Command line utility for accessing ANS services/APIs
License: MIT License
There's a new API endpoint for hostname based SSL/TLS recommendations (GET /ssl/v1/recommendations/{domain}
), it would be nice to add this.
When I try to update a SafeDNS template record, TTL is a required field but is not surfaced in the CLI model
Steps to reproduce the behavior:
phily ~ ukfast safedns template record create 9458 --name "testerer.[domain]" --content 1.2.3.4 --ttl 86400 --type MX --priority 20 --help
This command creates a template record
Usage:
ukfast safedns template record create <template: id/name> [flags]
Examples:
ukfast safedns template record create "main template" --name subdomain.ukfast.co.uk --type A --content 1.2.3.4
Flags:
--content string Record content
-h, --help help for create
--name string Name of record
--priority int Record priority
--ttl int Record priority
--type string Type of record
Global Flags:
--config string config file (default is $HOME/.ukfast.yml)
--filter stringArray filter for list commands, can be repeated, e.g. 'property=somevalue', 'property:gt=3', 'property=valu*'
-o, --output string output type {table, json, jsonpath, template, value, csv, list}, with optional argument provided as 'outputname=outputargument'
--page int page to retrieve for paginated requests
--property strings property to output (used with several formats), can be repeated
--sort string output sorting, e.g. 'name', 'name:asc', 'name:desc'
phily ~ ukfast safedns template record create 9458 --name "testerer.[domain]" --content 1.2.3.4 --priority 20 --ttl 86400 --type MX
Generated URI: https://api.ukfast.io/safedns/v1/templates/9458/records
Encoded body: {"name":"testerer.[domain]","type":"MX","content":"1.2.3.4","priority":20}
Executing request: POST https://api.ukfast.io/safedns/v1/templates/9458/records
Got response: StatusCode=[422]
Response body: {"errors":[{"title":"Validation Error","detail":"The ttl field is required","status":422,"source":"ttl"}]}
Error creating record: unexpected status code (422): title="Validation Error", detail="The ttl field is required", status="422", source="ttl"
phily ~
A clear and concise description of what you expected to happen.
I'd expect to be able to send a TTL
Add this to the struct for CRUD template operations:
type CreateRecordRequest struct {
connection.APIRequestBodyDefaultValidator
Name string `json:"name" validate:"required"`
TemplateID int `json:"template_id,omitempty"`
Type string `json:"type" validate:"required"`
Content string `json:"content" validate:"required"`
Priority *int `json:"priority,omitempty"`
}
No further details
We should add support for generating zsh completions
https://github.com/ans-group/cli/blob/master/cmd/cloudflare/cloudflare_zone.go line 127
The 'update' command shows the same description as the 'Remove' command
I'm unsure why this is, but when I do a ukfast ecloud vm list -o json | jq
command, these fields are blank:
power_status
tools_status
hdd_disks
When I run the ukfast ecloud vm show <SID> -o json | jq
for the server, I see the values are present
Steps to reproduce the behaviour:
ukfast ecloud vm list -o json | jq
power_status
, tools_status
and hdd_disks
values for the first entryukfast ecloud vm show <SID> -o json | jq
using the SID for the first entrySame values should be returned in both cases, even if the keys should differ between the two
N/A
N/A
We should handle pagination for list
commands globally, as so that user can control this (aswell as navigating pages)
As in #45, custom error pages would make another location where it would be nice to upload a file, such as in DDoSX.
I see this as working nicely as both a post-deploy automation action for an application and making the tool more intuitive for a human user, as we have seen in after #45 was implemented.
Example command for ukfast safedns record delete
doesn't match usage text.
ukfast safedns record delete --help
❯ ukfast safedns record delete --help
This command removes one or more zone records
Usage:
ukfast safedns record delete <zone: name> <record: id>... [flags]
Examples:
ukfast safedns zone record delete ukfast.co.uk 123
N/A
N/A
On the command ukfast safedns note create {domainName}
, it requires the flag --ip
.
This parameter is no longer used by the API so we should remove it from the command in this tool.
Existing output from the help for this command:
Usage:
ukfast safedns note create <zone: name> [flags]Examples:
ukfast safedns zone note create ukfast.co.uk --name subdomain.ukfast.co.uk --type A --content 1.2.3.4Flags:
-h, --help help for create
--ip string Note IP address
--notes string Note contentGlobal Flags:
--config string config file (default is $HOME/.ukfast.yaml)
--filter stringArray filter for list commands, can be repeated, e.g. 'property=somevalue', 'property:gt=3', 'property=valu*'
-f, --format string output format {table, json, template, value, csv}
--outputtemplate string output Go template (used with 'template' format), e.g. 'Name: {{ .Name }}'
--property strings property to output (used with several formats), can be repeated
--sort string output sorting, e.g. 'name', 'name:asc', 'name:desc'
I would like to be able to close my PSS ticket via the API.
This can be done in two ways, allowing me to update the status on ukfast pss request update {id}
and some syntactic sugar of ukfast pss request close {id}
This allows customers to close tickets from the CLI tool, as they can raise and reply here but, as they can't complete, it leaves it to UKFast or the customer going into MyUKFast.
I tried to do this via an update of a ticket and the flag wasn't allowed, but the API endpoint will accept a status: https://developers.ukfast.io/documentation/pss#/Requests/patch_pss_v1_requests__id_
A nice feature would be able to run an SSL/TLS report on domais from the command line.
There are already two APIs that allow us to do this (at https://developers.ukfast.io/documentation/ssl) with the difference being one allows for an IP scoping (useful for checking IPv4 vs IPv6).
Discussion: should we add confirmation into delete
commands, with a flag for bypassing the confirmation (such as --force
)?
Currently, the --property
flag only supports using an asterisk *
for denoting 'all properties'. We should support globbing for this.
We should use cobra.Command.RunE()
over cobra.Command.Run()
for all commands to reduce the amount of per-command error handling
Currently creating e.g. an SPF record can cause an error:
❯ ukfast safedns zone record create example.com --name mail.example.com --content "v=spf1 mx a -all" --type SPF
Error creating record: unexpected status code (422): title="Validation Error", detail="SPF records must be enclosed in double quotes", status="422", source="content"
It would be nice if the double quoting could be handled transparently for record types which require double quoting. This can be done using fmt.Sprintf("%q", v)
.
Saves having to add double quotes in the content argument, or being confused as to why it's asking for double quotes when you've already double-quoted the argument string.
N/A
All commands are currently in a single package, cmd
. Let's fix this.
Add the ability to retrieve a single DDoSX access logs for a domain, using the endpoint /ddosx/v1/domains/{name}/access-logs{id}
This allows users to list their DDoSX access logs from the CLI, much like the WAF logs
The documentation is available at https://developers.ukfast.io/documentation/ddosx
This issue is discuss the possibility of changing the --format/-f
flags to --output/-o
, as I feel this is a better description of what this does.
We should investigate adding local filtering to complement the current server-side filtering offered via the --filter
flag. I would propose a --localfilter
flag for this
This will allow for filtering on properties which aren't yet supported server-side
Add the ability to retrieve a global list of DDoSX access logs, using the endpoint /ddosx/v1/access-logs
This allows users to list their DDoSX access logs from the CLI, much like the WAF logs
The documentation is available at https://developers.ukfast.io/documentation/ddosx
It would be nice if this worked in the same way as the WAF logs
When using table output for the invoice information with v1.3.9, the output has more decimal places added than the JSON output format, e.g.:
❯ ukfast account invoice show 45185
+-------+------------+------+-----------+-----------+-----------+
| ID | DATE | PAID | NET | VAT | GROSS |
+-------+------------+------+-----------+-----------+-----------+
| 45185 | 2020-03-28 | true | 72.980003 | 12.780000 | 85.760002 |
+-------+------------+------+-----------+-----------+-----------+
❯ ukfast account invoice show 45185 -o json
[{"id":45185,"date":"2020-03-28","paid":true,"net":72.98,"vat":12.78,"gross":85.76}]
The values in the table also seem incorrect as it's adding very small amounts to the values.
The CLI tool is missing the command ukfast ddosx domain record delete
.
The endpoint which it needs to hit is DELETE /ddosx/v1/domains/{name}records/{id}
with no parameters and it should expect a response code of 204 on a successful deletion.
The documentation for this endpoint is at https://developers.ukfast.io/documentation/ddosx#/Record/delete_ddosx_v1_domains__name__records__id_
Add the ability to retrieve a list of DDoSX access logs for a domain, using the endpoint /ddosx/v1/domains/{name}/access-logs
This allows users to list their DDoSX access logs from the CLI, much like the WAF logs
The documentation is available at https://developers.ukfast.io/documentation/ddosx
With commands that accept certificates, we should allow these to be specified from files. Currently, the entire contents must be supplied as parameters which isn't intuitive
Add the ability to retrieve a single DDoSX access log, using the endpoint /ddosx/v1/access-logs/{id}
This allows users to list their DDoSX access logs from the CLI, much like the WAF logs
The documentation is available at https://developers.ukfast.io/documentation/ddosx
It would be nice if this worked in the same way as the WAF logs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.