Giter Club home page Giter Club logo

cli's People

Contributors

0x4c6565 avatar gavtaylor avatar laf avatar miff2000 avatar overglazed avatar rbibby avatar tommybobbins avatar xiol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cli's Issues

TTL Not Being Set On Template Records

What is the issue?

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

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  ~ 

Expected behaviour

A clear and concise description of what you expected to happen.

I'd expect to be able to send a TTL

Possible fixes

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"`
}

Additional context

No further details

`ecloud vm list` incorrectly returns no value for certain keys

What is the issue?

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

Steps to reproduce the behaviour:

  1. Run ukfast ecloud vm list -o json | jq
  2. Check out the power_status, tools_status and hdd_disks values for the first entry
  3. Run ukfast ecloud vm show <SID> -o json | jq using the SID for the first entry
  4. Check the difference.

Expected behaviour

Same values should be returned in both cases, even if the keys should differ between the two

Possible fixes

N/A

Additional context

N/A

Handle pagination

We should handle pagination for list commands globally, as so that user can control this (aswell as navigating pages)

Allowing Custom Error Pages From A File

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.

Record delete example doesn't match usage text

What is the issue?

Example command for ukfast safedns record delete doesn't match usage text.

image

Steps To Reproduce

ukfast safedns record delete --help

Expected behaviour

❯ 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

Possible fixes

N/A

Additional context

N/A

Remove `ip` as a required flag for SafeDNS notes

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.4

Flags:
-h, --help help for create
--ip string Note IP address
--notes string Note content

Global 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'

Add Closing Of PSS Tickets

What is the feature?

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}

What benefits will this change bring?

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.

Additional context

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_

Smarter glob for 'property' flag

Currently, the --property flag only supports using an asterisk * for denoting 'all properties'. We should support globbing for this.

Use cobra.Command.RunE()

We should use cobra.Command.RunE() over cobra.Command.Run() for all commands to reduce the amount of per-command error handling

Transparently double quote content strings when required

What is the feature?

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).

What benefits will this change bring?

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.

Additional context

N/A

Local filtering

What is the feature?

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

What benefits will this change bring?

This will allow for filtering on properties which aren't yet supported server-side

Add DDoSX Global Access Logs List Command

What is the feature?

Add the ability to retrieve a global list of DDoSX access logs, using the endpoint /ddosx/v1/access-logs

What benefits will this change bring?

This allows users to list their DDoSX access logs from the CLI, much like the WAF logs

Additional context

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

Table output for invoice information is using too many decimal places

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.

Certificate from file

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 DDoSX Global Access Logs Show Command

What is the feature?

Add the ability to retrieve a single DDoSX access log, using the endpoint /ddosx/v1/access-logs/{id}

What benefits will this change bring?

This allows users to list their DDoSX access logs from the CLI, much like the WAF logs

Additional context

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.