mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
chore(code-up): latest version of all code
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-compute1-cli"
|
||||
version = "0.1.0+20150326"
|
||||
version = "0.2.0+20150326"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||
description = "A complete library to interact with compute (protocol v1)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli"
|
||||
@@ -17,15 +17,14 @@ keywords = ["compute", "google", "cli"]
|
||||
name = "compute1"
|
||||
|
||||
[dependencies]
|
||||
hyper = "*"
|
||||
hyper = ">= 0.4.0"
|
||||
mime = "*"
|
||||
yup-oauth2 = "*"
|
||||
docopt = "*"
|
||||
docopt_macros = "*"
|
||||
rustc-serialize = "*"
|
||||
strsim = "*"
|
||||
yup-hyper-mock = "*"
|
||||
serde = ">= 0.3.0"
|
||||
serde_macros = "*"
|
||||
clap = "*"
|
||||
|
||||
[dependencies.google-compute1]
|
||||
path = "../compute1"
|
||||
|
||||
@@ -10,166 +10,196 @@ capabilities. Errors will be printed to standard error, and cause the program's
|
||||
|
||||
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
||||
|
||||
Everything else about the *compute* API can be found at the
|
||||
[official documentation site](https://developers.google.com/compute/docs/reference/latest/).
|
||||
|
||||
# Usage
|
||||
|
||||
This documentation was generated from the *compute* API at revision *20150326*. The CLI is at version *0.1.0*.
|
||||
This documentation was generated from the *compute* API at revision *20150326*. The CLI is at version *0.2.0*.
|
||||
|
||||
```bash
|
||||
compute1 [options] addresses aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] addresses delete <project> <region> <address> [-p <v>...] [-o <out>]
|
||||
compute1 [options] addresses get <project> <region> <address> [-p <v>...] [-o <out>]
|
||||
compute1 [options] addresses insert <project> <region> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] addresses list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services delete <project> <backend-service> [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services get <project> <backend-service> [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services get-health <project> <backend-service> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services patch <project> <backend-service> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] backend-services update <project> <backend-service> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] disk-types aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disk-types get <project> <zone> <disk-type> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disk-types list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks create-snapshot <project> <zone> <disk> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks delete <project> <zone> <disk> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks get <project> <zone> <disk> [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks insert <project> <zone> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] disks list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls delete <project> <firewall> [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls get <project> <firewall> [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls patch <project> <firewall> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] firewalls update <project> <firewall> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules delete <project> <region> <forwarding-rule> [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules get <project> <region> <forwarding-rule> [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules insert <project> <region> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] forwarding-rules set-target <project> <region> <forwarding-rule> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-addresses delete <project> <address> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-addresses get <project> <address> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-addresses insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-addresses list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-forwarding-rules delete <project> <forwarding-rule> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-forwarding-rules get <project> <forwarding-rule> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-forwarding-rules insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-forwarding-rules list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-forwarding-rules set-target <project> <forwarding-rule> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-operations aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-operations delete <project> <operation> [-p <v>...]
|
||||
compute1 [options] global-operations get <project> <operation> [-p <v>...] [-o <out>]
|
||||
compute1 [options] global-operations list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks delete <project> <http-health-check> [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks get <project> <http-health-check> [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks patch <project> <http-health-check> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] http-health-checks update <project> <http-health-check> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] images delete <project> <image> [-p <v>...] [-o <out>]
|
||||
compute1 [options] images deprecate <project> <image> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] images get <project> <image> [-p <v>...] [-o <out>]
|
||||
compute1 [options] images insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] images list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instance-templates delete <project> <instance-template> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instance-templates get <project> <instance-template> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instance-templates insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instance-templates list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances add-access-config <project> <zone> <instance> <network-interface> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances attach-disk <project> <zone> <instance> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances delete <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances delete-access-config <project> <zone> <instance> <access-config> <network-interface> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances detach-disk <project> <zone> <instance> <device-name> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances get <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances get-serial-port-output <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances insert <project> <zone> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances reset <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances set-disk-auto-delete <project> <zone> <instance> <auto-delete> <device-name> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances set-metadata <project> <zone> <instance> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances set-scheduling <project> <zone> <instance> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances set-tags <project> <zone> <instance> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances start <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] instances stop <project> <zone> <instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] licenses get <project> <license> [-p <v>...] [-o <out>]
|
||||
compute1 [options] machine-types aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] machine-types get <project> <zone> <machine-type> [-p <v>...] [-o <out>]
|
||||
compute1 [options] machine-types list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] networks delete <project> <network> [-p <v>...] [-o <out>]
|
||||
compute1 [options] networks get <project> <network> [-p <v>...] [-o <out>]
|
||||
compute1 [options] networks insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] networks list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] projects get <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] projects move-disk <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] projects move-instance <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] projects set-common-instance-metadata <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] projects set-usage-export-bucket <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] region-operations delete <project> <region> <operation> [-p <v>...]
|
||||
compute1 [options] region-operations get <project> <region> <operation> [-p <v>...] [-o <out>]
|
||||
compute1 [options] region-operations list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] regions get <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] regions list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] routes delete <project> <route> [-p <v>...] [-o <out>]
|
||||
compute1 [options] routes get <project> <route> [-p <v>...] [-o <out>]
|
||||
compute1 [options] routes insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] routes list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] snapshots delete <project> <snapshot> [-p <v>...] [-o <out>]
|
||||
compute1 [options] snapshots get <project> <snapshot> [-p <v>...] [-o <out>]
|
||||
compute1 [options] snapshots list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-http-proxies delete <project> <target-http-proxy> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-http-proxies get <project> <target-http-proxy> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-http-proxies insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-http-proxies list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-http-proxies set-url-map <project> <target-http-proxy> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-instances aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-instances delete <project> <zone> <target-instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-instances get <project> <zone> <target-instance> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-instances insert <project> <zone> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-instances list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools add-health-check <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools add-instance <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools delete <project> <region> <target-pool> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools get <project> <region> <target-pool> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools get-health <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools insert <project> <region> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools remove-health-check <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools remove-instance <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-pools set-backup <project> <region> <target-pool> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-vpn-gateways aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-vpn-gateways delete <project> <region> <target-vpn-gateway> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-vpn-gateways get <project> <region> <target-vpn-gateway> [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-vpn-gateways insert <project> <region> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] target-vpn-gateways list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps delete <project> <url-map> [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps get <project> <url-map> [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps insert <project> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps patch <project> <url-map> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps update <project> <url-map> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] url-maps validate <project> <url-map> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] vpn-tunnels aggregated-list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options] vpn-tunnels delete <project> <region> <vpn-tunnel> [-p <v>...] [-o <out>]
|
||||
compute1 [options] vpn-tunnels get <project> <region> <vpn-tunnel> [-p <v>...] [-o <out>]
|
||||
compute1 [options] vpn-tunnels insert <project> <region> -r <kv>... [-p <v>...] [-o <out>]
|
||||
compute1 [options] vpn-tunnels list <project> <region> [-p <v>...] [-o <out>]
|
||||
compute1 [options] zone-operations delete <project> <zone> <operation> [-p <v>...]
|
||||
compute1 [options] zone-operations get <project> <zone> <operation> [-p <v>...] [-o <out>]
|
||||
compute1 [options] zone-operations list <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] zones get <project> <zone> [-p <v>...] [-o <out>]
|
||||
compute1 [options] zones list <project> [-p <v>...] [-o <out>]
|
||||
compute1 [options]
|
||||
addresses
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <address> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <address> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
backend-services
|
||||
delete <project> <backend-service> [-p <v>]... [-o <out>]
|
||||
get <project> <backend-service> [-p <v>]... [-o <out>]
|
||||
get-health <project> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
disk-types
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <disk-type> [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
disks
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
create-snapshot <project> <zone> <disk> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <disk> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <disk> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
firewalls
|
||||
delete <project> <firewall> [-p <v>]... [-o <out>]
|
||||
get <project> <firewall> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <firewall> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <firewall> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
forwarding-rules
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <forwarding-rule> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <forwarding-rule> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
set-target <project> <region> <forwarding-rule> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
global-addresses
|
||||
delete <project> <address> [-p <v>]... [-o <out>]
|
||||
get <project> <address> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
global-forwarding-rules
|
||||
delete <project> <forwarding-rule> [-p <v>]... [-o <out>]
|
||||
get <project> <forwarding-rule> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-target <project> <forwarding-rule> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
global-operations
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <operation> [-p <v>]...
|
||||
get <project> <operation> [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
http-health-checks
|
||||
delete <project> <http-health-check> [-p <v>]... [-o <out>]
|
||||
get <project> <http-health-check> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <http-health-check> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <http-health-check> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
images
|
||||
delete <project> <image> [-p <v>]... [-o <out>]
|
||||
deprecate <project> <image> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
get <project> <image> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
instance-templates
|
||||
delete <project> <instance-template> [-p <v>]... [-o <out>]
|
||||
get <project> <instance-template> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
instances
|
||||
add-access-config <project> <zone> <instance> <network-interface> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
attach-disk <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
delete-access-config <project> <zone> <instance> <access-config> <network-interface> [-p <v>]... [-o <out>]
|
||||
detach-disk <project> <zone> <instance> <device-name> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
get-serial-port-output <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
reset <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
set-disk-auto-delete <project> <zone> <instance> <auto-delete> <device-name> [-p <v>]... [-o <out>]
|
||||
set-metadata <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-scheduling <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-tags <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
start <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
stop <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
licenses
|
||||
get <project> <license> [-p <v>]... [-o <out>]
|
||||
machine-types
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <machine-type> [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
networks
|
||||
delete <project> <network> [-p <v>]... [-o <out>]
|
||||
get <project> <network> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
projects
|
||||
get <project> [-p <v>]... [-o <out>]
|
||||
move-disk <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
move-instance <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-common-instance-metadata <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-usage-export-bucket <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
region-operations
|
||||
delete <project> <region> <operation> [-p <v>]...
|
||||
get <project> <region> <operation> [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
regions
|
||||
get <project> <region> [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
routes
|
||||
delete <project> <route> [-p <v>]... [-o <out>]
|
||||
get <project> <route> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
snapshots
|
||||
delete <project> <snapshot> [-p <v>]... [-o <out>]
|
||||
get <project> <snapshot> [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
target-http-proxies
|
||||
delete <project> <target-http-proxy> [-p <v>]... [-o <out>]
|
||||
get <project> <target-http-proxy> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-url-map <project> <target-http-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
target-instances
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <target-instance> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <target-instance> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
target-pools
|
||||
add-health-check <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
add-instance <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <target-pool> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <target-pool> [-p <v>]... [-o <out>]
|
||||
get-health <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
remove-health-check <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
remove-instance <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-backup <project> <region> <target-pool> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
target-vpn-gateways
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <target-vpn-gateway> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <target-vpn-gateway> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
url-maps
|
||||
delete <project> <url-map> [-p <v>]... [-o <out>]
|
||||
get <project> <url-map> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <url-map> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <url-map> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
validate <project> <url-map> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
vpn-tunnels
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <vpn-tunnel> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <vpn-tunnel> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
zone-operations
|
||||
delete <project> <zone> <operation> [-p <v>]...
|
||||
get <project> <zone> <operation> [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
zones
|
||||
get <project> <zone> [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
compute1 --help
|
||||
|
||||
All documentation details can be found at
|
||||
http://byron.github.io/google-apis-rs/google_compute1_cli/index.html
|
||||
|
||||
Configuration:
|
||||
--scope <url>
|
||||
[--scope <url>]...
|
||||
Specify the authentication a method should be executed in. Each scope
|
||||
requires the user to grant this application permission to use it.
|
||||
requires the user to grant this application permission to use it.
|
||||
If unset, it defaults to the shortest scope url for a particular method.
|
||||
--config-dir <folder>
|
||||
A directory into which we will store our persistent data. Defaults to
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
site_name: compute v0.1.0+20150326
|
||||
site_name: compute v0.2.0+20150326
|
||||
site_url: http://byron.github.io/google-apis-rs/google-compute1-cli
|
||||
site_description: Write integrating applications with bcore
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// COPY OF 'src/rust/cli/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
||||
use rustc_serialize::json;
|
||||
use serde::json;
|
||||
use mime::Mime;
|
||||
use clap::{App, SubCommand};
|
||||
use strsim;
|
||||
|
||||
use std::fs;
|
||||
use std::env;
|
||||
@@ -17,6 +19,74 @@ use std::default::Default;
|
||||
|
||||
const FIELD_SEP: char = '.';
|
||||
|
||||
// Based on @erickt user comment. Thanks for the idea !
|
||||
// Remove all keys whose values are null from given value (changed in place)
|
||||
pub fn remove_json_null_values(value: &mut json::value::Value) {
|
||||
match *value {
|
||||
json::value::Value::Object(ref mut map) => {
|
||||
let mut for_removal = Vec::new();
|
||||
|
||||
for (key, mut value) in map.iter_mut() {
|
||||
if value.is_null() {
|
||||
for_removal.push(key.clone());
|
||||
} else {
|
||||
remove_json_null_values(&mut value);
|
||||
}
|
||||
}
|
||||
|
||||
for key in &for_removal {
|
||||
map.remove(key);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> {
|
||||
|
||||
let mut candidate: Option<(f64, &str)> = None;
|
||||
for pv in possible_values {
|
||||
let confidence = strsim::jaro_winkler(v, pv);
|
||||
if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) {
|
||||
candidate = Some((confidence, pv));
|
||||
}
|
||||
}
|
||||
match candidate {
|
||||
None => None,
|
||||
Some((_, candidate)) => Some(candidate),
|
||||
}
|
||||
}
|
||||
|
||||
pub enum CallType {
|
||||
Upload(UploadProtocol),
|
||||
Standard,
|
||||
}
|
||||
|
||||
arg_enum!{
|
||||
pub enum UploadProtocol {
|
||||
Simple,
|
||||
Resumable
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for UploadProtocol {
|
||||
fn as_ref(&self) -> &str {
|
||||
match *self {
|
||||
UploadProtocol::Simple => "simple",
|
||||
UploadProtocol::Resumable => "resumable"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for CallType {
|
||||
fn as_ref(&self) -> &str {
|
||||
match *self {
|
||||
CallType::Upload(ref proto) => proto.as_ref(),
|
||||
CallType::Standard => "standard-request"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct FieldCursor(Vec<String>);
|
||||
|
||||
@@ -88,6 +158,49 @@ impl FieldCursor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option<String> {
|
||||
if value.len() == 0 {
|
||||
return None
|
||||
}
|
||||
|
||||
let mut last_c = FIELD_SEP;
|
||||
|
||||
let mut field = String::new();
|
||||
let mut output = String::new();
|
||||
|
||||
let push_field = |fs: &mut String, f: &mut String| {
|
||||
if f.len() > 0 {
|
||||
fs.push_str(
|
||||
match did_you_mean(&f, possible_values) {
|
||||
Some(candidate) => candidate,
|
||||
None => &f,
|
||||
});
|
||||
f.truncate(0);
|
||||
}
|
||||
};
|
||||
|
||||
for (cid, c) in value.chars().enumerate() {
|
||||
if c == FIELD_SEP {
|
||||
if last_c != FIELD_SEP {
|
||||
push_field(&mut output, &mut field);
|
||||
}
|
||||
output.push(c);
|
||||
} else {
|
||||
field.push(c);
|
||||
}
|
||||
|
||||
last_c = c;
|
||||
}
|
||||
|
||||
push_field(&mut output, &mut field);
|
||||
|
||||
if &output == value {
|
||||
None
|
||||
} else {
|
||||
Some(output)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn num_fields(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
@@ -112,6 +225,17 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
|
||||
}
|
||||
}
|
||||
|
||||
pub fn calltype_from_str(name: &str, valid_protocols: Vec<String>, err: &mut InvalidOptionsError) -> CallType {
|
||||
CallType::Upload(
|
||||
match UploadProtocol::from_str(name) {
|
||||
Ok(up) => up,
|
||||
Err(msg) => {
|
||||
err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols));
|
||||
UploadProtocol::Simple
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
||||
match fs::File::open(file_path) {
|
||||
Ok(f) => Some(f),
|
||||
@@ -132,13 +256,14 @@ pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option
|
||||
}
|
||||
}
|
||||
|
||||
// May panic if we can't open the file - this is anticipated, we can't currently communicate this
|
||||
// kind of error: TODO: fix this architecture :)
|
||||
pub fn writer_from_opts(flag: bool, arg: &str) -> Box<Write> {
|
||||
if !flag || arg == "-" {
|
||||
Box::new(stdout())
|
||||
} else {
|
||||
Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap())
|
||||
pub fn writer_from_opts(arg: Option<&str>) -> Result<Box<Write>, io::Error> {
|
||||
let f = arg.unwrap_or("-");
|
||||
match f {
|
||||
"-" => Ok(Box::new(stdout())),
|
||||
_ => match fs::OpenOptions::new().create(true).write(true).open(f) {
|
||||
Ok(f) => Ok(Box::new(f)),
|
||||
Err(io_err) => Err(io_err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +276,7 @@ pub fn arg_from_str<T>(arg: &str, err: &mut InvalidOptionsError,
|
||||
match FromStr::from_str(arg) {
|
||||
Err(perr) => {
|
||||
err.issues.push(
|
||||
CLIError::ParseError((arg_name, arg_type, arg.to_string(), format!("{}", perr)))
|
||||
CLIError::ParseError(arg_name, arg_type, arg.to_string(), format!("{}", perr))
|
||||
);
|
||||
Default::default()
|
||||
},
|
||||
@@ -171,49 +296,47 @@ impl JsonTokenStorage {
|
||||
}
|
||||
|
||||
impl TokenStorage for JsonTokenStorage {
|
||||
type Error = io::Error;
|
||||
type Error = json::Error;
|
||||
|
||||
// NOTE: logging might be interesting, currently we swallow all errors
|
||||
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Option<io::Error> {
|
||||
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), json::Error> {
|
||||
match token {
|
||||
None => {
|
||||
match fs::remove_file(self.path(scope_hash)) {
|
||||
Err(err) =>
|
||||
match err.kind() {
|
||||
io::ErrorKind::NotFound => None,
|
||||
_ => Some(err)
|
||||
io::ErrorKind::NotFound => Ok(()),
|
||||
_ => Err(json::Error::IoError(err))
|
||||
},
|
||||
Ok(_) => None
|
||||
Ok(_) => Ok(()),
|
||||
}
|
||||
}
|
||||
Some(token) => {
|
||||
let json_token = json::encode(&token).unwrap();
|
||||
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
||||
Ok(mut f) => {
|
||||
match f.write(json_token.as_bytes()) {
|
||||
Ok(_) => None,
|
||||
Err(io_err) => Some(io_err),
|
||||
match json::to_writer_pretty(&mut f, &token) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(io_err) => Err(json::Error::IoError(io_err)),
|
||||
}
|
||||
},
|
||||
Err(io_err) => Some(io_err)
|
||||
Err(io_err) => Err(json::Error::IoError(io_err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, io::Error> {
|
||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, json::Error> {
|
||||
match fs::File::open(&self.path(scope_hash)) {
|
||||
Ok(mut f) => {
|
||||
let mut json_string = String::new();
|
||||
match f.read_to_string(&mut json_string) {
|
||||
Ok(_) => Ok(Some(json::decode::<Token>(&json_string).unwrap())),
|
||||
Err(io_err) => Err(io_err),
|
||||
match json::de::from_reader(f) {
|
||||
Ok(token) => Ok(Some(token)),
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
},
|
||||
Err(io_err) => {
|
||||
match io_err.kind() {
|
||||
io::ErrorKind::NotFound => Ok(None),
|
||||
_ => Err(io_err)
|
||||
_ => Err(json::Error::IoError(io_err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,7 +346,7 @@ impl TokenStorage for JsonTokenStorage {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ApplicationSecretError {
|
||||
DecoderError((String, json::DecoderError)),
|
||||
DecoderError((String, json::Error)),
|
||||
FormatError(String),
|
||||
}
|
||||
|
||||
@@ -231,10 +354,10 @@ impl fmt::Display for ApplicationSecretError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
ApplicationSecretError::DecoderError((ref path, ref err))
|
||||
=> writeln!(f, "Could not decode file at '{}' with error: {}",
|
||||
=> writeln!(f, "Could not decode file at '{}' with error: {}.",
|
||||
path, err),
|
||||
ApplicationSecretError::FormatError(ref path)
|
||||
=> writeln!(f, "'installed' field is unset in secret file at '{}'",
|
||||
=> writeln!(f, "'installed' field is unset in secret file at '{}'.",
|
||||
path),
|
||||
}
|
||||
}
|
||||
@@ -253,15 +376,15 @@ impl fmt::Display for ConfigurationError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
ConfigurationError::DirectoryCreationFailed((ref dir, ref err))
|
||||
=> writeln!(f, "Directory '{}' could not be created with error: {}", dir, err),
|
||||
=> writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err),
|
||||
ConfigurationError::DirectoryUnset
|
||||
=> writeln!(f, "--config-dir was unset or empty"),
|
||||
=> writeln!(f, "--config-dir was unset or empty."),
|
||||
ConfigurationError::HomeExpansionFailed(ref dir)
|
||||
=> writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'", dir),
|
||||
=> writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir),
|
||||
ConfigurationError::Secret(ref err)
|
||||
=> writeln!(f, "Secret -> {}", err),
|
||||
ConfigurationError::IOError((ref path, ref err))
|
||||
=> writeln!(f, "IO operation failed on path '{}' with error: {}", path, err),
|
||||
=> writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,9 +399,9 @@ impl fmt::Display for InputError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
InputError::IOError((ref file_path, ref io_err))
|
||||
=> writeln!(f, "Failed to open '{}' for reading with error: {}", file_path, io_err),
|
||||
=> writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err),
|
||||
InputError::Mime(ref mime)
|
||||
=> writeln!(f, "'{}' is not a known mime-type", mime),
|
||||
=> writeln!(f, "'{}' is not a known mime-type.", mime),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +410,7 @@ impl fmt::Display for InputError {
|
||||
pub enum FieldError {
|
||||
PopOnEmpty(String),
|
||||
TrailingFieldSep(String),
|
||||
Unknown(String),
|
||||
Unknown(String, Option<String>, Option<String>),
|
||||
Empty,
|
||||
}
|
||||
|
||||
@@ -296,13 +419,26 @@ impl fmt::Display for FieldError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
FieldError::PopOnEmpty(ref field)
|
||||
=> writeln!(f, "'{}': Cannot move up on empty field cursor", field),
|
||||
=> writeln!(f, "'{}': Cannot move up on empty field cursor.", field),
|
||||
FieldError::TrailingFieldSep(ref field)
|
||||
=> writeln!(f, "'{}': Single field separator may not be last character", field),
|
||||
FieldError::Unknown(ref field)
|
||||
=> writeln!(f, "Field '{}' does not exist", field),
|
||||
=> writeln!(f, "'{}': Single field separator may not be last character.", field),
|
||||
FieldError::Unknown(ref field, ref suggestion, ref value) => {
|
||||
let suffix =
|
||||
match *suggestion {
|
||||
Some(ref s) => {
|
||||
let kv =
|
||||
match *value {
|
||||
Some(ref v) => format!("{}={}", s, v),
|
||||
None => s.clone(),
|
||||
};
|
||||
format!(" Did you mean '{}' ?", kv)
|
||||
},
|
||||
None => String::new(),
|
||||
};
|
||||
writeln!(f, "Field '{}' does not exist.{}", field, suffix)
|
||||
},
|
||||
FieldError::Empty
|
||||
=> writeln!(f, "Field names must not be empty"),
|
||||
=> writeln!(f, "Field names must not be empty."),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,11 +447,14 @@ impl fmt::Display for FieldError {
|
||||
#[derive(Debug)]
|
||||
pub enum CLIError {
|
||||
Configuration(ConfigurationError),
|
||||
ParseError((&'static str, &'static str, String, String)),
|
||||
UnknownParameter(String),
|
||||
ParseError(&'static str, &'static str, String, String),
|
||||
UnknownParameter(String, Vec<&'static str>),
|
||||
InvalidUploadProtocol(String, Vec<String>),
|
||||
InvalidKeyValueSyntax(String, bool),
|
||||
Input(InputError),
|
||||
Field(FieldError),
|
||||
MissingCommandError,
|
||||
MissingMethodError(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for CLIError {
|
||||
@@ -324,15 +463,25 @@ impl fmt::Display for CLIError {
|
||||
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
||||
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
||||
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
||||
CLIError::ParseError((arg_name, type_name, ref value, ref err_desc))
|
||||
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
||||
CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names)
|
||||
=> writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.connect(", ")),
|
||||
CLIError::ParseError(arg_name, type_name, ref value, ref err_desc)
|
||||
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.",
|
||||
arg_name, value, type_name, err_desc),
|
||||
CLIError::UnknownParameter(ref param_name)
|
||||
=> writeln!(f, "Parameter '{}' is unknown.", param_name),
|
||||
CLIError::UnknownParameter(ref param_name, ref possible_values) => {
|
||||
let mut suffix =
|
||||
match did_you_mean(param_name, &possible_values) {
|
||||
Some(v) => format!(" Did you mean '{}' ?", v),
|
||||
None => String::new(),
|
||||
};
|
||||
write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix)
|
||||
},
|
||||
CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => {
|
||||
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>.", kv, hashmap_info)
|
||||
},
|
||||
CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."),
|
||||
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,7 +548,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
|
||||
|
||||
pub fn application_secret_from_directory(dir: &str,
|
||||
secret_basename: &str,
|
||||
json_app_secret: &str)
|
||||
json_console_secret: &str)
|
||||
-> Result<ApplicationSecret, CLIError> {
|
||||
let secret_path = Path::new(dir).join(secret_basename);
|
||||
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
||||
@@ -418,7 +567,10 @@ pub fn application_secret_from_directory(dir: &str,
|
||||
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
||||
Err(cfe) => cfe,
|
||||
Ok(mut f) => {
|
||||
match f.write(json_app_secret.as_bytes()) {
|
||||
// Assure we convert 'ugly' json string into pretty one
|
||||
let console_secret: ConsoleApplicationSecret
|
||||
= json::from_str(json_console_secret).unwrap();
|
||||
match json::to_writer_pretty(&mut f, &console_secret) {
|
||||
Err(io_err) => io_err,
|
||||
Ok(_) => continue,
|
||||
}
|
||||
@@ -429,23 +581,24 @@ pub fn application_secret_from_directory(dir: &str,
|
||||
return secret_io_error(err)
|
||||
},
|
||||
Ok(mut f) => {
|
||||
let mut json_encoded_secret = String::new();
|
||||
if let Err(io_err) = f.read_to_string(&mut json_encoded_secret) {
|
||||
return secret_io_error(io_err)
|
||||
}
|
||||
match json::decode::<ConsoleApplicationSecret>(&json_encoded_secret) {
|
||||
Err(json_decode_error) => return Err(CLIError::Configuration(
|
||||
ConfigurationError::Secret(ApplicationSecretError::DecoderError(
|
||||
(secret_str(), json_decode_error)
|
||||
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||
Err(json::Error::IoError(err)) =>
|
||||
return secret_io_error(err),
|
||||
Err(json_err) =>
|
||||
return Err(CLIError::Configuration(
|
||||
ConfigurationError::Secret(
|
||||
ApplicationSecretError::DecoderError(
|
||||
(secret_str(), json_err)
|
||||
)))),
|
||||
Ok(console_secret) => match console_secret.installed {
|
||||
Some(secret) => return Ok(secret),
|
||||
None => return Err(
|
||||
CLIError::Configuration(
|
||||
ConfigurationError::Secret(
|
||||
ApplicationSecretError::FormatError(secret_str())
|
||||
)))
|
||||
},
|
||||
Ok(console_secret) =>
|
||||
match console_secret.installed {
|
||||
Some(secret) => return Ok(secret),
|
||||
None => return Err(
|
||||
CLIError::Configuration(
|
||||
ConfigurationError::Secret(
|
||||
ApplicationSecretError::FormatError(secret_str())
|
||||
)))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user