mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-06 11:34:34 +01:00
@@ -15,7 +15,6 @@ api:
|
||||
- runtimeconfig
|
||||
- analyticsreporting
|
||||
# Doesn't work with stable due to a known issue serializing it using syntex_syntax
|
||||
- compute
|
||||
- servicecontrol
|
||||
- servicemanagement
|
||||
# defines its own `Option` type
|
||||
|
||||
40
gen/compute1-cli/Cargo.toml
Normal file
40
gen/compute1-cli/Cargo.toml
Normal file
@@ -0,0 +1,40 @@
|
||||
# DO NOT EDIT !
|
||||
# This file was generated automatically from 'src/mako/Cargo.toml.mako'
|
||||
# DO NOT EDIT !
|
||||
[package]
|
||||
|
||||
name = "google-compute1-cli"
|
||||
version = "1.0.7+20171122"
|
||||
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"
|
||||
homepage = "https://developers.google.com/compute/docs/reference/latest/"
|
||||
documentation = "http://byron.github.io/google-apis-rs/google_compute1_cli"
|
||||
license = "MIT"
|
||||
keywords = ["compute", "google", "cli"]
|
||||
|
||||
[[bin]]
|
||||
name = "compute1"
|
||||
|
||||
[dev-dependencies]
|
||||
hyper-rustls = "^0.6"
|
||||
|
||||
[dependencies]
|
||||
hyper = "^ 0.10"
|
||||
mime = "^ 0.2.0"
|
||||
serde = "^ 1.0"
|
||||
serde_json = "^ 1.0"
|
||||
serde_derive = "^ 1.0"
|
||||
yup-oauth2 = "^ 1.0"
|
||||
strsim = "^0.5"
|
||||
hyper-rustls = "^0.6"
|
||||
yup-hyper-mock = "^2.0"
|
||||
clap = "^2.0"
|
||||
|
||||
[features]
|
||||
|
||||
|
||||
|
||||
[dependencies.google-compute1]
|
||||
path = "../compute1"
|
||||
version = "1.0.7+20171122"
|
||||
30
gen/compute1-cli/LICENSE.md
Normal file
30
gen/compute1-cli/LICENSE.md
Normal file
@@ -0,0 +1,30 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/LICENSE.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © `2015-2016` `Sebastian Thiel`
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
465
gen/compute1-cli/README.md
Normal file
465
gen/compute1-cli/README.md
Normal file
@@ -0,0 +1,465 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/cli/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `compute1` command-line interface *(CLI)* allows to use most features of the *Google compute* service from the comfort of your terminal.
|
||||
|
||||
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
|
||||
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
|
||||
|
||||
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/).
|
||||
|
||||
# Installation and Source Code
|
||||
|
||||
Install the command-line interface with cargo using:
|
||||
|
||||
```bash
|
||||
cargo install google-compute1-cli
|
||||
```
|
||||
|
||||
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli).
|
||||
|
||||
# Usage
|
||||
|
||||
This documentation was generated from the *compute* API at revision *20171122*. The CLI is at version *1.0.7*.
|
||||
|
||||
```bash
|
||||
compute1 [options]
|
||||
accelerator-types
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <accelerator-type> [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
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>]
|
||||
autoscalers
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <autoscaler> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <autoscaler> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
patch <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
backend-buckets
|
||||
delete <project> <backend-bucket> [-p <v>]... [-o <out>]
|
||||
get <project> <backend-bucket> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <backend-bucket> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <backend-bucket> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
backend-services
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
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>]
|
||||
resize <project> <zone> <disk> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-labels <project> <zone> <resource> (-r <kv>)... [-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>]
|
||||
health-checks
|
||||
delete <project> <health-check> [-p <v>]... [-o <out>]
|
||||
get <project> <health-check> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <health-check> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <health-check> (-r <kv>)... [-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>]
|
||||
https-health-checks
|
||||
delete <project> <https-health-check> [-p <v>]... [-o <out>]
|
||||
get <project> <https-health-check> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <https-health-check> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <https-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>]
|
||||
get-from-family <project> <family> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-labels <project> <resource> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
instance-group-managers
|
||||
abandon-instances <project> <zone> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
delete-instances <project> <zone> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
list-managed-instances <project> <zone> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
recreate-instances <project> <zone> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
resize <project> <zone> <instance-group-manager> <size> [-p <v>]... [-o <out>]
|
||||
set-instance-template <project> <zone> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-target-pools <project> <zone> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
instance-groups
|
||||
add-instances <project> <zone> <instance-group> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <zone> <instance-group> [-p <v>]... [-o <out>]
|
||||
get <project> <zone> <instance-group> [-p <v>]... [-o <out>]
|
||||
insert <project> <zone> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <zone> [-p <v>]... [-o <out>]
|
||||
list-instances <project> <zone> <instance-group> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
remove-instances <project> <zone> <instance-group> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-named-ports <project> <zone> <instance-group> (-r <kv>)... [-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-deletion-protection <project> <zone> <resource> [-p <v>]... [-o <out>]
|
||||
set-disk-auto-delete <project> <zone> <instance> <auto-delete> <device-name> [-p <v>]... [-o <out>]
|
||||
set-labels <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-machine-resources <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-machine-type <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-metadata <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-min-cpu-platform <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-scheduling <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-service-account <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>]
|
||||
start-with-encryption-key <project> <zone> <instance> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
stop <project> <zone> <instance> [-p <v>]... [-o <out>]
|
||||
interconnect-attachments
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <interconnect-attachment> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <interconnect-attachment> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
interconnect-locations
|
||||
get <project> <interconnect-location> [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
interconnects
|
||||
delete <project> <interconnect> [-p <v>]... [-o <out>]
|
||||
get <project> <interconnect> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
patch <project> <interconnect> (-r <kv>)... [-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
|
||||
add-peering <project> <network> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
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>]
|
||||
patch <project> <network> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
remove-peering <project> <network> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
switch-to-custom-mode <project> <network> [-p <v>]... [-o <out>]
|
||||
projects
|
||||
disable-xpn-host <project> [-p <v>]... [-o <out>]
|
||||
disable-xpn-resource <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
enable-xpn-host <project> [-p <v>]... [-o <out>]
|
||||
enable-xpn-resource <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
get <project> [-p <v>]... [-o <out>]
|
||||
get-xpn-host <project> [-p <v>]... [-o <out>]
|
||||
get-xpn-resources <project> [-p <v>]... [-o <out>]
|
||||
list-xpn-hosts <project> (-r <kv>)... [-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-autoscalers
|
||||
delete <project> <region> <autoscaler> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <autoscaler> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
patch <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
region-backend-services
|
||||
delete <project> <region> <backend-service> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <backend-service> [-p <v>]... [-o <out>]
|
||||
get-health <project> <region> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
patch <project> <region> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <region> <backend-service> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
region-commitments
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <commitment> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
region-instance-group-managers
|
||||
abandon-instances <project> <region> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
delete-instances <project> <region> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
get <project> <region> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
list-managed-instances <project> <region> <instance-group-manager> [-p <v>]... [-o <out>]
|
||||
recreate-instances <project> <region> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
resize <project> <region> <instance-group-manager> <size> [-p <v>]... [-o <out>]
|
||||
set-instance-template <project> <region> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-target-pools <project> <region> <instance-group-manager> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
region-instance-groups
|
||||
get <project> <region> <instance-group> [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
list-instances <project> <region> <instance-group> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-named-ports <project> <region> <instance-group> (-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>]
|
||||
routers
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <router> [-p <v>]... [-o <out>]
|
||||
get <project> <region> <router> [-p <v>]... [-o <out>]
|
||||
get-router-status <project> <region> <router> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
patch <project> <region> <router> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
preview <project> <region> <router> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
update <project> <region> <router> (-r <kv>)... [-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>]
|
||||
set-labels <project> <resource> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
ssl-certificates
|
||||
delete <project> <ssl-certificate> [-p <v>]... [-o <out>]
|
||||
get <project> <ssl-certificate> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
subnetworks
|
||||
aggregated-list <project> [-p <v>]... [-o <out>]
|
||||
delete <project> <region> <subnetwork> [-p <v>]... [-o <out>]
|
||||
expand-ip-cidr-range <project> <region> <subnetwork> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
get <project> <region> <subnetwork> [-p <v>]... [-o <out>]
|
||||
insert <project> <region> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> <region> [-p <v>]... [-o <out>]
|
||||
set-private-ip-google-access <project> <region> <subnetwork> (-r <kv>)... [-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-https-proxies
|
||||
delete <project> <target-https-proxy> [-p <v>]... [-o <out>]
|
||||
get <project> <target-https-proxy> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-ssl-certificates <project> <target-https-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-url-map <project> <target-https-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-ssl-proxies
|
||||
delete <project> <target-ssl-proxy> [-p <v>]... [-o <out>]
|
||||
get <project> <target-ssl-proxy> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-backend-service <project> <target-ssl-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-proxy-header <project> <target-ssl-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-ssl-certificates <project> <target-ssl-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
target-tcp-proxies
|
||||
delete <project> <target-tcp-proxy> [-p <v>]... [-o <out>]
|
||||
get <project> <target-tcp-proxy> [-p <v>]... [-o <out>]
|
||||
insert <project> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
list <project> [-p <v>]... [-o <out>]
|
||||
set-backend-service <project> <target-tcp-proxy> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||
set-proxy-header <project> <target-tcp-proxy> (-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>]
|
||||
invalidate-cache <project> <url-map> (-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
|
||||
|
||||
Configuration:
|
||||
[--scope <url>]...
|
||||
Specify the authentication a method should be executed in. Each scope
|
||||
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
|
||||
a user-writable directory that we will create during the first invocation.
|
||||
[default: ~/.google-service-cli]
|
||||
--debug
|
||||
Output all server communication to standard error. `tx` and `rx` are placed
|
||||
into the same stream.
|
||||
--debug-auth
|
||||
Output all communication related to authentication to standard error. `tx`
|
||||
and `rx` are placed into the same stream.
|
||||
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `compute1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
|
||||
|
||||
More information about the various kinds of persistent data are given in the following paragraphs.
|
||||
|
||||
# Authentication
|
||||
|
||||
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
|
||||
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
|
||||
|
||||
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
|
||||
method that is read-only, it will ask only for a read-only scope.
|
||||
You may use the `--scope` flag to specify a scope directly.
|
||||
All applicable scopes are documented in the respective method's CLI documentation.
|
||||
|
||||
The first time a scope is used, the user is asked for permission. Follow the instructions given
|
||||
by the CLI to grant permissions, or to decline.
|
||||
|
||||
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
|
||||
directory, e.g. `~/.google-service-cli/compute1-token-<scope-hash>.json`. No manual management of these tokens
|
||||
is necessary.
|
||||
|
||||
To revoke granted authentication, please refer to the [official documentation][revoke-access].
|
||||
|
||||
# Application Secrets
|
||||
|
||||
In order to allow any application to use Google services, it will need to be registered using the
|
||||
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
|
||||
one by one. Most APIs can be used for free and have a daily quota.
|
||||
|
||||
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
|
||||
comes with a default application secret that is configured accordingly. This also means that heavy usage
|
||||
all around the world may deplete the daily quota.
|
||||
|
||||
You can workaround this limitation by putting your own secrets file at this location:
|
||||
`~/.google-service-cli/compute1-secret.json`, assuming that the required *compute* API
|
||||
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
|
||||
*APIs & auth -> Credentials -> Download JSON* and used as is.
|
||||
|
||||
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
|
||||
|
||||
|
||||
# Debugging
|
||||
|
||||
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
|
||||
what exactly led to a particular issue. This is done by allowing all client-server communication to be
|
||||
output to standard error *as-is*.
|
||||
|
||||
The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag
|
||||
will cause all communication related to authentication to standard error.
|
||||
If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the
|
||||
issue at hand.
|
||||
|
||||
You may consider redirecting standard error into a file for ease of use, e.g. `compute1 --debug <resource> <method> [options] 2>debug.txt`.
|
||||
|
||||
|
||||
[scopes]: https://developers.google.com/+/api/oauth#scopes
|
||||
[revoke-access]: http://webapps.stackexchange.com/a/30849
|
||||
[google-dev-console]: https://console.developers.google.com/
|
||||
[google-project-new]: https://developers.google.com/console/help/new/
|
||||
319
gen/compute1-cli/mkdocs.yml
Normal file
319
gen/compute1-cli/mkdocs.yml
Normal file
@@ -0,0 +1,319 @@
|
||||
site_name: compute v1.0.7+20171122
|
||||
site_url: http://byron.github.io/google-apis-rs/google-compute1-cli
|
||||
site_description: A complete library to interact with compute (protocol v1)
|
||||
|
||||
repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli
|
||||
|
||||
docs_dir: docs
|
||||
site_dir: build_html
|
||||
|
||||
pages:
|
||||
- ['index.md', 'Home']
|
||||
- ['accelerator-types_aggregated-list.md', 'Accelerator Types', 'Aggregated List']
|
||||
- ['accelerator-types_get.md', 'Accelerator Types', 'Get']
|
||||
- ['accelerator-types_list.md', 'Accelerator Types', 'List']
|
||||
- ['addresses_aggregated-list.md', 'Addresses', 'Aggregated List']
|
||||
- ['addresses_delete.md', 'Addresses', 'Delete']
|
||||
- ['addresses_get.md', 'Addresses', 'Get']
|
||||
- ['addresses_insert.md', 'Addresses', 'Insert']
|
||||
- ['addresses_list.md', 'Addresses', 'List']
|
||||
- ['autoscalers_aggregated-list.md', 'Autoscalers', 'Aggregated List']
|
||||
- ['autoscalers_delete.md', 'Autoscalers', 'Delete']
|
||||
- ['autoscalers_get.md', 'Autoscalers', 'Get']
|
||||
- ['autoscalers_insert.md', 'Autoscalers', 'Insert']
|
||||
- ['autoscalers_list.md', 'Autoscalers', 'List']
|
||||
- ['autoscalers_patch.md', 'Autoscalers', 'Patch']
|
||||
- ['autoscalers_update.md', 'Autoscalers', 'Update']
|
||||
- ['backend-buckets_delete.md', 'Backend Buckets', 'Delete']
|
||||
- ['backend-buckets_get.md', 'Backend Buckets', 'Get']
|
||||
- ['backend-buckets_insert.md', 'Backend Buckets', 'Insert']
|
||||
- ['backend-buckets_list.md', 'Backend Buckets', 'List']
|
||||
- ['backend-buckets_patch.md', 'Backend Buckets', 'Patch']
|
||||
- ['backend-buckets_update.md', 'Backend Buckets', 'Update']
|
||||
- ['backend-services_aggregated-list.md', 'Backend Services', 'Aggregated List']
|
||||
- ['backend-services_delete.md', 'Backend Services', 'Delete']
|
||||
- ['backend-services_get.md', 'Backend Services', 'Get']
|
||||
- ['backend-services_get-health.md', 'Backend Services', 'Get Health']
|
||||
- ['backend-services_insert.md', 'Backend Services', 'Insert']
|
||||
- ['backend-services_list.md', 'Backend Services', 'List']
|
||||
- ['backend-services_patch.md', 'Backend Services', 'Patch']
|
||||
- ['backend-services_update.md', 'Backend Services', 'Update']
|
||||
- ['disk-types_aggregated-list.md', 'Disk Types', 'Aggregated List']
|
||||
- ['disk-types_get.md', 'Disk Types', 'Get']
|
||||
- ['disk-types_list.md', 'Disk Types', 'List']
|
||||
- ['disks_aggregated-list.md', 'Disks', 'Aggregated List']
|
||||
- ['disks_create-snapshot.md', 'Disks', 'Create Snapshot']
|
||||
- ['disks_delete.md', 'Disks', 'Delete']
|
||||
- ['disks_get.md', 'Disks', 'Get']
|
||||
- ['disks_insert.md', 'Disks', 'Insert']
|
||||
- ['disks_list.md', 'Disks', 'List']
|
||||
- ['disks_resize.md', 'Disks', 'Resize']
|
||||
- ['disks_set-labels.md', 'Disks', 'Set Labels']
|
||||
- ['firewalls_delete.md', 'Firewalls', 'Delete']
|
||||
- ['firewalls_get.md', 'Firewalls', 'Get']
|
||||
- ['firewalls_insert.md', 'Firewalls', 'Insert']
|
||||
- ['firewalls_list.md', 'Firewalls', 'List']
|
||||
- ['firewalls_patch.md', 'Firewalls', 'Patch']
|
||||
- ['firewalls_update.md', 'Firewalls', 'Update']
|
||||
- ['forwarding-rules_aggregated-list.md', 'Forwarding Rules', 'Aggregated List']
|
||||
- ['forwarding-rules_delete.md', 'Forwarding Rules', 'Delete']
|
||||
- ['forwarding-rules_get.md', 'Forwarding Rules', 'Get']
|
||||
- ['forwarding-rules_insert.md', 'Forwarding Rules', 'Insert']
|
||||
- ['forwarding-rules_list.md', 'Forwarding Rules', 'List']
|
||||
- ['forwarding-rules_set-target.md', 'Forwarding Rules', 'Set Target']
|
||||
- ['global-addresses_delete.md', 'Global Addresses', 'Delete']
|
||||
- ['global-addresses_get.md', 'Global Addresses', 'Get']
|
||||
- ['global-addresses_insert.md', 'Global Addresses', 'Insert']
|
||||
- ['global-addresses_list.md', 'Global Addresses', 'List']
|
||||
- ['global-forwarding-rules_delete.md', 'Global Forwarding Rules', 'Delete']
|
||||
- ['global-forwarding-rules_get.md', 'Global Forwarding Rules', 'Get']
|
||||
- ['global-forwarding-rules_insert.md', 'Global Forwarding Rules', 'Insert']
|
||||
- ['global-forwarding-rules_list.md', 'Global Forwarding Rules', 'List']
|
||||
- ['global-forwarding-rules_set-target.md', 'Global Forwarding Rules', 'Set Target']
|
||||
- ['global-operations_aggregated-list.md', 'Global Operations', 'Aggregated List']
|
||||
- ['global-operations_delete.md', 'Global Operations', 'Delete']
|
||||
- ['global-operations_get.md', 'Global Operations', 'Get']
|
||||
- ['global-operations_list.md', 'Global Operations', 'List']
|
||||
- ['health-checks_delete.md', 'Health Checks', 'Delete']
|
||||
- ['health-checks_get.md', 'Health Checks', 'Get']
|
||||
- ['health-checks_insert.md', 'Health Checks', 'Insert']
|
||||
- ['health-checks_list.md', 'Health Checks', 'List']
|
||||
- ['health-checks_patch.md', 'Health Checks', 'Patch']
|
||||
- ['health-checks_update.md', 'Health Checks', 'Update']
|
||||
- ['http-health-checks_delete.md', 'Http Health Checks', 'Delete']
|
||||
- ['http-health-checks_get.md', 'Http Health Checks', 'Get']
|
||||
- ['http-health-checks_insert.md', 'Http Health Checks', 'Insert']
|
||||
- ['http-health-checks_list.md', 'Http Health Checks', 'List']
|
||||
- ['http-health-checks_patch.md', 'Http Health Checks', 'Patch']
|
||||
- ['http-health-checks_update.md', 'Http Health Checks', 'Update']
|
||||
- ['https-health-checks_delete.md', 'Https Health Checks', 'Delete']
|
||||
- ['https-health-checks_get.md', 'Https Health Checks', 'Get']
|
||||
- ['https-health-checks_insert.md', 'Https Health Checks', 'Insert']
|
||||
- ['https-health-checks_list.md', 'Https Health Checks', 'List']
|
||||
- ['https-health-checks_patch.md', 'Https Health Checks', 'Patch']
|
||||
- ['https-health-checks_update.md', 'Https Health Checks', 'Update']
|
||||
- ['images_delete.md', 'Images', 'Delete']
|
||||
- ['images_deprecate.md', 'Images', 'Deprecate']
|
||||
- ['images_get.md', 'Images', 'Get']
|
||||
- ['images_get-from-family.md', 'Images', 'Get From Family']
|
||||
- ['images_insert.md', 'Images', 'Insert']
|
||||
- ['images_list.md', 'Images', 'List']
|
||||
- ['images_set-labels.md', 'Images', 'Set Labels']
|
||||
- ['instance-group-managers_abandon-instances.md', 'Instance Group Managers', 'Abandon Instances']
|
||||
- ['instance-group-managers_aggregated-list.md', 'Instance Group Managers', 'Aggregated List']
|
||||
- ['instance-group-managers_delete.md', 'Instance Group Managers', 'Delete']
|
||||
- ['instance-group-managers_delete-instances.md', 'Instance Group Managers', 'Delete Instances']
|
||||
- ['instance-group-managers_get.md', 'Instance Group Managers', 'Get']
|
||||
- ['instance-group-managers_insert.md', 'Instance Group Managers', 'Insert']
|
||||
- ['instance-group-managers_list.md', 'Instance Group Managers', 'List']
|
||||
- ['instance-group-managers_list-managed-instances.md', 'Instance Group Managers', 'List Managed Instances']
|
||||
- ['instance-group-managers_recreate-instances.md', 'Instance Group Managers', 'Recreate Instances']
|
||||
- ['instance-group-managers_resize.md', 'Instance Group Managers', 'Resize']
|
||||
- ['instance-group-managers_set-instance-template.md', 'Instance Group Managers', 'Set Instance Template']
|
||||
- ['instance-group-managers_set-target-pools.md', 'Instance Group Managers', 'Set Target Pools']
|
||||
- ['instance-groups_add-instances.md', 'Instance Groups', 'Add Instances']
|
||||
- ['instance-groups_aggregated-list.md', 'Instance Groups', 'Aggregated List']
|
||||
- ['instance-groups_delete.md', 'Instance Groups', 'Delete']
|
||||
- ['instance-groups_get.md', 'Instance Groups', 'Get']
|
||||
- ['instance-groups_insert.md', 'Instance Groups', 'Insert']
|
||||
- ['instance-groups_list.md', 'Instance Groups', 'List']
|
||||
- ['instance-groups_list-instances.md', 'Instance Groups', 'List Instances']
|
||||
- ['instance-groups_remove-instances.md', 'Instance Groups', 'Remove Instances']
|
||||
- ['instance-groups_set-named-ports.md', 'Instance Groups', 'Set Named Ports']
|
||||
- ['instance-templates_delete.md', 'Instance Templates', 'Delete']
|
||||
- ['instance-templates_get.md', 'Instance Templates', 'Get']
|
||||
- ['instance-templates_insert.md', 'Instance Templates', 'Insert']
|
||||
- ['instance-templates_list.md', 'Instance Templates', 'List']
|
||||
- ['instances_add-access-config.md', 'Instances', 'Add Access Config']
|
||||
- ['instances_aggregated-list.md', 'Instances', 'Aggregated List']
|
||||
- ['instances_attach-disk.md', 'Instances', 'Attach Disk']
|
||||
- ['instances_delete.md', 'Instances', 'Delete']
|
||||
- ['instances_delete-access-config.md', 'Instances', 'Delete Access Config']
|
||||
- ['instances_detach-disk.md', 'Instances', 'Detach Disk']
|
||||
- ['instances_get.md', 'Instances', 'Get']
|
||||
- ['instances_get-serial-port-output.md', 'Instances', 'Get Serial Port Output']
|
||||
- ['instances_insert.md', 'Instances', 'Insert']
|
||||
- ['instances_list.md', 'Instances', 'List']
|
||||
- ['instances_reset.md', 'Instances', 'Reset']
|
||||
- ['instances_set-deletion-protection.md', 'Instances', 'Set Deletion Protection']
|
||||
- ['instances_set-disk-auto-delete.md', 'Instances', 'Set Disk Auto Delete']
|
||||
- ['instances_set-labels.md', 'Instances', 'Set Labels']
|
||||
- ['instances_set-machine-resources.md', 'Instances', 'Set Machine Resources']
|
||||
- ['instances_set-machine-type.md', 'Instances', 'Set Machine Type']
|
||||
- ['instances_set-metadata.md', 'Instances', 'Set Metadata']
|
||||
- ['instances_set-min-cpu-platform.md', 'Instances', 'Set Min Cpu Platform']
|
||||
- ['instances_set-scheduling.md', 'Instances', 'Set Scheduling']
|
||||
- ['instances_set-service-account.md', 'Instances', 'Set Service Account']
|
||||
- ['instances_set-tags.md', 'Instances', 'Set Tags']
|
||||
- ['instances_start.md', 'Instances', 'Start']
|
||||
- ['instances_start-with-encryption-key.md', 'Instances', 'Start With Encryption Key']
|
||||
- ['instances_stop.md', 'Instances', 'Stop']
|
||||
- ['interconnect-attachments_aggregated-list.md', 'Interconnect Attachments', 'Aggregated List']
|
||||
- ['interconnect-attachments_delete.md', 'Interconnect Attachments', 'Delete']
|
||||
- ['interconnect-attachments_get.md', 'Interconnect Attachments', 'Get']
|
||||
- ['interconnect-attachments_insert.md', 'Interconnect Attachments', 'Insert']
|
||||
- ['interconnect-attachments_list.md', 'Interconnect Attachments', 'List']
|
||||
- ['interconnect-locations_get.md', 'Interconnect Locations', 'Get']
|
||||
- ['interconnect-locations_list.md', 'Interconnect Locations', 'List']
|
||||
- ['interconnects_delete.md', 'Interconnects', 'Delete']
|
||||
- ['interconnects_get.md', 'Interconnects', 'Get']
|
||||
- ['interconnects_insert.md', 'Interconnects', 'Insert']
|
||||
- ['interconnects_list.md', 'Interconnects', 'List']
|
||||
- ['interconnects_patch.md', 'Interconnects', 'Patch']
|
||||
- ['licenses_get.md', 'Licenses', 'Get']
|
||||
- ['machine-types_aggregated-list.md', 'Machine Types', 'Aggregated List']
|
||||
- ['machine-types_get.md', 'Machine Types', 'Get']
|
||||
- ['machine-types_list.md', 'Machine Types', 'List']
|
||||
- ['networks_add-peering.md', 'Networks', 'Add Peering']
|
||||
- ['networks_delete.md', 'Networks', 'Delete']
|
||||
- ['networks_get.md', 'Networks', 'Get']
|
||||
- ['networks_insert.md', 'Networks', 'Insert']
|
||||
- ['networks_list.md', 'Networks', 'List']
|
||||
- ['networks_patch.md', 'Networks', 'Patch']
|
||||
- ['networks_remove-peering.md', 'Networks', 'Remove Peering']
|
||||
- ['networks_switch-to-custom-mode.md', 'Networks', 'Switch To Custom Mode']
|
||||
- ['projects_disable-xpn-host.md', 'Projects', 'Disable Xpn Host']
|
||||
- ['projects_disable-xpn-resource.md', 'Projects', 'Disable Xpn Resource']
|
||||
- ['projects_enable-xpn-host.md', 'Projects', 'Enable Xpn Host']
|
||||
- ['projects_enable-xpn-resource.md', 'Projects', 'Enable Xpn Resource']
|
||||
- ['projects_get.md', 'Projects', 'Get']
|
||||
- ['projects_get-xpn-host.md', 'Projects', 'Get Xpn Host']
|
||||
- ['projects_get-xpn-resources.md', 'Projects', 'Get Xpn Resources']
|
||||
- ['projects_list-xpn-hosts.md', 'Projects', 'List Xpn Hosts']
|
||||
- ['projects_move-disk.md', 'Projects', 'Move Disk']
|
||||
- ['projects_move-instance.md', 'Projects', 'Move Instance']
|
||||
- ['projects_set-common-instance-metadata.md', 'Projects', 'Set Common Instance Metadata']
|
||||
- ['projects_set-usage-export-bucket.md', 'Projects', 'Set Usage Export Bucket']
|
||||
- ['region-autoscalers_delete.md', 'Region Autoscalers', 'Delete']
|
||||
- ['region-autoscalers_get.md', 'Region Autoscalers', 'Get']
|
||||
- ['region-autoscalers_insert.md', 'Region Autoscalers', 'Insert']
|
||||
- ['region-autoscalers_list.md', 'Region Autoscalers', 'List']
|
||||
- ['region-autoscalers_patch.md', 'Region Autoscalers', 'Patch']
|
||||
- ['region-autoscalers_update.md', 'Region Autoscalers', 'Update']
|
||||
- ['region-backend-services_delete.md', 'Region Backend Services', 'Delete']
|
||||
- ['region-backend-services_get.md', 'Region Backend Services', 'Get']
|
||||
- ['region-backend-services_get-health.md', 'Region Backend Services', 'Get Health']
|
||||
- ['region-backend-services_insert.md', 'Region Backend Services', 'Insert']
|
||||
- ['region-backend-services_list.md', 'Region Backend Services', 'List']
|
||||
- ['region-backend-services_patch.md', 'Region Backend Services', 'Patch']
|
||||
- ['region-backend-services_update.md', 'Region Backend Services', 'Update']
|
||||
- ['region-commitments_aggregated-list.md', 'Region Commitments', 'Aggregated List']
|
||||
- ['region-commitments_get.md', 'Region Commitments', 'Get']
|
||||
- ['region-commitments_insert.md', 'Region Commitments', 'Insert']
|
||||
- ['region-commitments_list.md', 'Region Commitments', 'List']
|
||||
- ['region-instance-group-managers_abandon-instances.md', 'Region Instance Group Managers', 'Abandon Instances']
|
||||
- ['region-instance-group-managers_delete.md', 'Region Instance Group Managers', 'Delete']
|
||||
- ['region-instance-group-managers_delete-instances.md', 'Region Instance Group Managers', 'Delete Instances']
|
||||
- ['region-instance-group-managers_get.md', 'Region Instance Group Managers', 'Get']
|
||||
- ['region-instance-group-managers_insert.md', 'Region Instance Group Managers', 'Insert']
|
||||
- ['region-instance-group-managers_list.md', 'Region Instance Group Managers', 'List']
|
||||
- ['region-instance-group-managers_list-managed-instances.md', 'Region Instance Group Managers', 'List Managed Instances']
|
||||
- ['region-instance-group-managers_recreate-instances.md', 'Region Instance Group Managers', 'Recreate Instances']
|
||||
- ['region-instance-group-managers_resize.md', 'Region Instance Group Managers', 'Resize']
|
||||
- ['region-instance-group-managers_set-instance-template.md', 'Region Instance Group Managers', 'Set Instance Template']
|
||||
- ['region-instance-group-managers_set-target-pools.md', 'Region Instance Group Managers', 'Set Target Pools']
|
||||
- ['region-instance-groups_get.md', 'Region Instance Groups', 'Get']
|
||||
- ['region-instance-groups_list.md', 'Region Instance Groups', 'List']
|
||||
- ['region-instance-groups_list-instances.md', 'Region Instance Groups', 'List Instances']
|
||||
- ['region-instance-groups_set-named-ports.md', 'Region Instance Groups', 'Set Named Ports']
|
||||
- ['region-operations_delete.md', 'Region Operations', 'Delete']
|
||||
- ['region-operations_get.md', 'Region Operations', 'Get']
|
||||
- ['region-operations_list.md', 'Region Operations', 'List']
|
||||
- ['regions_get.md', 'Regions', 'Get']
|
||||
- ['regions_list.md', 'Regions', 'List']
|
||||
- ['routers_aggregated-list.md', 'Routers', 'Aggregated List']
|
||||
- ['routers_delete.md', 'Routers', 'Delete']
|
||||
- ['routers_get.md', 'Routers', 'Get']
|
||||
- ['routers_get-router-status.md', 'Routers', 'Get Router Status']
|
||||
- ['routers_insert.md', 'Routers', 'Insert']
|
||||
- ['routers_list.md', 'Routers', 'List']
|
||||
- ['routers_patch.md', 'Routers', 'Patch']
|
||||
- ['routers_preview.md', 'Routers', 'Preview']
|
||||
- ['routers_update.md', 'Routers', 'Update']
|
||||
- ['routes_delete.md', 'Routes', 'Delete']
|
||||
- ['routes_get.md', 'Routes', 'Get']
|
||||
- ['routes_insert.md', 'Routes', 'Insert']
|
||||
- ['routes_list.md', 'Routes', 'List']
|
||||
- ['snapshots_delete.md', 'Snapshots', 'Delete']
|
||||
- ['snapshots_get.md', 'Snapshots', 'Get']
|
||||
- ['snapshots_list.md', 'Snapshots', 'List']
|
||||
- ['snapshots_set-labels.md', 'Snapshots', 'Set Labels']
|
||||
- ['ssl-certificates_delete.md', 'Ssl Certificates', 'Delete']
|
||||
- ['ssl-certificates_get.md', 'Ssl Certificates', 'Get']
|
||||
- ['ssl-certificates_insert.md', 'Ssl Certificates', 'Insert']
|
||||
- ['ssl-certificates_list.md', 'Ssl Certificates', 'List']
|
||||
- ['subnetworks_aggregated-list.md', 'Subnetworks', 'Aggregated List']
|
||||
- ['subnetworks_delete.md', 'Subnetworks', 'Delete']
|
||||
- ['subnetworks_expand-ip-cidr-range.md', 'Subnetworks', 'Expand Ip Cidr Range']
|
||||
- ['subnetworks_get.md', 'Subnetworks', 'Get']
|
||||
- ['subnetworks_insert.md', 'Subnetworks', 'Insert']
|
||||
- ['subnetworks_list.md', 'Subnetworks', 'List']
|
||||
- ['subnetworks_set-private-ip-google-access.md', 'Subnetworks', 'Set Private Ip Google Access']
|
||||
- ['target-http-proxies_delete.md', 'Target Http Proxies', 'Delete']
|
||||
- ['target-http-proxies_get.md', 'Target Http Proxies', 'Get']
|
||||
- ['target-http-proxies_insert.md', 'Target Http Proxies', 'Insert']
|
||||
- ['target-http-proxies_list.md', 'Target Http Proxies', 'List']
|
||||
- ['target-http-proxies_set-url-map.md', 'Target Http Proxies', 'Set Url Map']
|
||||
- ['target-https-proxies_delete.md', 'Target Https Proxies', 'Delete']
|
||||
- ['target-https-proxies_get.md', 'Target Https Proxies', 'Get']
|
||||
- ['target-https-proxies_insert.md', 'Target Https Proxies', 'Insert']
|
||||
- ['target-https-proxies_list.md', 'Target Https Proxies', 'List']
|
||||
- ['target-https-proxies_set-ssl-certificates.md', 'Target Https Proxies', 'Set Ssl Certificates']
|
||||
- ['target-https-proxies_set-url-map.md', 'Target Https Proxies', 'Set Url Map']
|
||||
- ['target-instances_aggregated-list.md', 'Target Instances', 'Aggregated List']
|
||||
- ['target-instances_delete.md', 'Target Instances', 'Delete']
|
||||
- ['target-instances_get.md', 'Target Instances', 'Get']
|
||||
- ['target-instances_insert.md', 'Target Instances', 'Insert']
|
||||
- ['target-instances_list.md', 'Target Instances', 'List']
|
||||
- ['target-pools_add-health-check.md', 'Target Pools', 'Add Health Check']
|
||||
- ['target-pools_add-instance.md', 'Target Pools', 'Add Instance']
|
||||
- ['target-pools_aggregated-list.md', 'Target Pools', 'Aggregated List']
|
||||
- ['target-pools_delete.md', 'Target Pools', 'Delete']
|
||||
- ['target-pools_get.md', 'Target Pools', 'Get']
|
||||
- ['target-pools_get-health.md', 'Target Pools', 'Get Health']
|
||||
- ['target-pools_insert.md', 'Target Pools', 'Insert']
|
||||
- ['target-pools_list.md', 'Target Pools', 'List']
|
||||
- ['target-pools_remove-health-check.md', 'Target Pools', 'Remove Health Check']
|
||||
- ['target-pools_remove-instance.md', 'Target Pools', 'Remove Instance']
|
||||
- ['target-pools_set-backup.md', 'Target Pools', 'Set Backup']
|
||||
- ['target-ssl-proxies_delete.md', 'Target Ssl Proxies', 'Delete']
|
||||
- ['target-ssl-proxies_get.md', 'Target Ssl Proxies', 'Get']
|
||||
- ['target-ssl-proxies_insert.md', 'Target Ssl Proxies', 'Insert']
|
||||
- ['target-ssl-proxies_list.md', 'Target Ssl Proxies', 'List']
|
||||
- ['target-ssl-proxies_set-backend-service.md', 'Target Ssl Proxies', 'Set Backend Service']
|
||||
- ['target-ssl-proxies_set-proxy-header.md', 'Target Ssl Proxies', 'Set Proxy Header']
|
||||
- ['target-ssl-proxies_set-ssl-certificates.md', 'Target Ssl Proxies', 'Set Ssl Certificates']
|
||||
- ['target-tcp-proxies_delete.md', 'Target Tcp Proxies', 'Delete']
|
||||
- ['target-tcp-proxies_get.md', 'Target Tcp Proxies', 'Get']
|
||||
- ['target-tcp-proxies_insert.md', 'Target Tcp Proxies', 'Insert']
|
||||
- ['target-tcp-proxies_list.md', 'Target Tcp Proxies', 'List']
|
||||
- ['target-tcp-proxies_set-backend-service.md', 'Target Tcp Proxies', 'Set Backend Service']
|
||||
- ['target-tcp-proxies_set-proxy-header.md', 'Target Tcp Proxies', 'Set Proxy Header']
|
||||
- ['target-vpn-gateways_aggregated-list.md', 'Target Vpn Gateways', 'Aggregated List']
|
||||
- ['target-vpn-gateways_delete.md', 'Target Vpn Gateways', 'Delete']
|
||||
- ['target-vpn-gateways_get.md', 'Target Vpn Gateways', 'Get']
|
||||
- ['target-vpn-gateways_insert.md', 'Target Vpn Gateways', 'Insert']
|
||||
- ['target-vpn-gateways_list.md', 'Target Vpn Gateways', 'List']
|
||||
- ['url-maps_delete.md', 'Url Maps', 'Delete']
|
||||
- ['url-maps_get.md', 'Url Maps', 'Get']
|
||||
- ['url-maps_insert.md', 'Url Maps', 'Insert']
|
||||
- ['url-maps_invalidate-cache.md', 'Url Maps', 'Invalidate Cache']
|
||||
- ['url-maps_list.md', 'Url Maps', 'List']
|
||||
- ['url-maps_patch.md', 'Url Maps', 'Patch']
|
||||
- ['url-maps_update.md', 'Url Maps', 'Update']
|
||||
- ['url-maps_validate.md', 'Url Maps', 'Validate']
|
||||
- ['vpn-tunnels_aggregated-list.md', 'Vpn Tunnels', 'Aggregated List']
|
||||
- ['vpn-tunnels_delete.md', 'Vpn Tunnels', 'Delete']
|
||||
- ['vpn-tunnels_get.md', 'Vpn Tunnels', 'Get']
|
||||
- ['vpn-tunnels_insert.md', 'Vpn Tunnels', 'Insert']
|
||||
- ['vpn-tunnels_list.md', 'Vpn Tunnels', 'List']
|
||||
- ['zone-operations_delete.md', 'Zone Operations', 'Delete']
|
||||
- ['zone-operations_get.md', 'Zone Operations', 'Get']
|
||||
- ['zone-operations_list.md', 'Zone Operations', 'List']
|
||||
- ['zones_get.md', 'Zones', 'Get']
|
||||
- ['zones_list.md', 'Zones', 'List']
|
||||
|
||||
theme: readthedocs
|
||||
|
||||
copyright: Copyright © 2015-2016, `Sebastian Thiel`
|
||||
|
||||
799
gen/compute1-cli/src/cmn.rs
Normal file
799
gen/compute1-cli/src/cmn.rs
Normal file
@@ -0,0 +1,799 @@
|
||||
// COPY OF 'src/rust/cli/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
||||
use serde_json as json;
|
||||
use serde_json::value::Value;
|
||||
use mime::Mime;
|
||||
use clap::{App, SubCommand};
|
||||
use strsim;
|
||||
|
||||
use std::fs;
|
||||
use std::env;
|
||||
use std::io;
|
||||
use std::error::Error as StdError;
|
||||
use std::fmt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::string::ToString;
|
||||
use std::io::{Write, Read, stdout};
|
||||
|
||||
use std::default::Default;
|
||||
|
||||
const FIELD_SEP: char = '.';
|
||||
|
||||
|
||||
pub enum ComplexType {
|
||||
Pod,
|
||||
Vec,
|
||||
Map,
|
||||
}
|
||||
|
||||
// Null,
|
||||
// Bool(bool),
|
||||
// I64(i64),
|
||||
// U64(u64),
|
||||
// F64(f64),
|
||||
// String(String),
|
||||
|
||||
pub enum JsonType {
|
||||
Boolean,
|
||||
Int,
|
||||
Uint,
|
||||
Float,
|
||||
String,
|
||||
}
|
||||
|
||||
pub struct JsonTypeInfo {
|
||||
pub jtype: JsonType,
|
||||
pub ctype: ComplexType,
|
||||
}
|
||||
|
||||
// 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 Value) {
|
||||
match *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>);
|
||||
|
||||
impl ToString for FieldCursor {
|
||||
fn to_string(&self) -> String {
|
||||
self.0.join(".")
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for FieldCursor {
|
||||
fn from(value: &'static str) -> FieldCursor {
|
||||
let mut res = FieldCursor::default();
|
||||
res.set(value).unwrap();
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
fn assure_entry<'a, 'b>(m: &'a mut json::Map<String, Value>, k: &'b String) -> &'a mut Value {
|
||||
if m.contains_key(k) {
|
||||
return m.get_mut(k).expect("value to exist");
|
||||
}
|
||||
m.insert(k.to_owned(), Value::Object(Default::default()));
|
||||
m.get_mut(k).expect("value to exist")
|
||||
}
|
||||
|
||||
impl FieldCursor {
|
||||
pub fn set(&mut self, value: &str) -> Result<(), CLIError> {
|
||||
if value.len() == 0 {
|
||||
return Err(CLIError::Field(FieldError::Empty));
|
||||
}
|
||||
|
||||
let mut first_is_field_sep = false;
|
||||
let mut char_count: usize = 0;
|
||||
let mut last_c = FIELD_SEP;
|
||||
let mut num_conscutive_field_seps = 0;
|
||||
|
||||
let mut field = String::new();
|
||||
let mut fields = self.0.clone();
|
||||
|
||||
let push_field = |fs: &mut Vec<String>, f: &mut String| {
|
||||
if f.len() > 0 {
|
||||
fs.push(f.clone());
|
||||
f.truncate(0);
|
||||
}
|
||||
};
|
||||
|
||||
for (cid, c) in value.chars().enumerate() {
|
||||
char_count += 1;
|
||||
|
||||
if c == FIELD_SEP {
|
||||
if cid == 0 {
|
||||
first_is_field_sep = true;
|
||||
}
|
||||
num_conscutive_field_seps += 1;
|
||||
if cid > 0 && last_c == FIELD_SEP {
|
||||
if fields.pop().is_none() {
|
||||
return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string())));
|
||||
}
|
||||
} else {
|
||||
push_field(&mut fields, &mut field);
|
||||
}
|
||||
} else {
|
||||
num_conscutive_field_seps = 0;
|
||||
if cid == 1 {
|
||||
if first_is_field_sep {
|
||||
fields.truncate(0);
|
||||
}
|
||||
}
|
||||
field.push(c);
|
||||
}
|
||||
|
||||
last_c = c;
|
||||
}
|
||||
|
||||
push_field(&mut fields, &mut field);
|
||||
|
||||
if char_count == 1 && first_is_field_sep {
|
||||
fields.truncate(0);
|
||||
}
|
||||
if char_count > 1 && num_conscutive_field_seps == 1 {
|
||||
return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string())));
|
||||
}
|
||||
|
||||
self.0 = fields;
|
||||
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 set_json_value(&self,
|
||||
mut object: &mut Value,
|
||||
value: &str,
|
||||
type_info: JsonTypeInfo,
|
||||
err: &mut InvalidOptionsError,
|
||||
orig_cursor: &FieldCursor) {
|
||||
assert!(self.0.len() > 0);
|
||||
|
||||
for field in &self.0[..self.0.len() - 1] {
|
||||
let tmp = object;
|
||||
object = match *tmp {
|
||||
Value::Object(ref mut mapping) => {
|
||||
assure_entry(mapping, &field)
|
||||
}
|
||||
_ => panic!("We don't expect non-object Values here ..."),
|
||||
};
|
||||
}
|
||||
|
||||
match *object {
|
||||
Value::Object(ref mut mapping) => {
|
||||
let field = &self.0[self.0.len() - 1];
|
||||
let to_jval = |value: &str,
|
||||
jtype: JsonType,
|
||||
err: &mut InvalidOptionsError|
|
||||
-> Value {
|
||||
match jtype {
|
||||
JsonType::Boolean =>
|
||||
Value::Bool(arg_from_str(value, err, &field, "boolean")),
|
||||
JsonType::Int =>
|
||||
Value::Number(json::Number::from_f64(arg_from_str(value,
|
||||
err,
|
||||
&field,
|
||||
"int"))
|
||||
.expect("valid f64")),
|
||||
JsonType::Uint =>
|
||||
Value::Number(json::Number::from_f64(arg_from_str(value,
|
||||
err,
|
||||
&field,
|
||||
"uint"))
|
||||
.expect("valid f64")),
|
||||
JsonType::Float =>
|
||||
Value::Number(json::Number::from_f64(arg_from_str(value,
|
||||
err,
|
||||
&field,
|
||||
"float"))
|
||||
.expect("valid f64")),
|
||||
JsonType::String => Value::String(value.to_owned()),
|
||||
}
|
||||
};
|
||||
|
||||
match type_info.ctype {
|
||||
ComplexType::Pod => {
|
||||
if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err))
|
||||
.is_some() {
|
||||
err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
ComplexType::Vec => {
|
||||
match *assure_entry(mapping, field) {
|
||||
Value::Array(ref mut values) =>
|
||||
values.push(to_jval(value, type_info.jtype, err)),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
ComplexType::Map => {
|
||||
let (key, value) = parse_kv_arg(value, err, true);
|
||||
let jval = to_jval(value.unwrap_or(""), type_info.jtype, err);
|
||||
|
||||
match *assure_entry(mapping, &field) {
|
||||
|
||||
Value::Object(ref mut value_map) => {
|
||||
if value_map.insert(key.to_owned(), jval).is_some() {
|
||||
err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn num_fields(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_kv_arg<'a>(kv: &'a str,
|
||||
err: &mut InvalidOptionsError,
|
||||
for_hashmap: bool)
|
||||
-> (&'a str, Option<&'a str>) {
|
||||
let mut add_err = || {
|
||||
err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap))
|
||||
};
|
||||
match kv.find('=') {
|
||||
None => {
|
||||
add_err();
|
||||
return (kv, None);
|
||||
}
|
||||
Some(pos) => {
|
||||
let key = &kv[..pos];
|
||||
if kv.len() <= pos + 1 {
|
||||
add_err();
|
||||
return (key, Some(""));
|
||||
}
|
||||
(key, Some(&kv[pos + 1..]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
Err(io_err) => {
|
||||
err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err))));
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option<Mime> {
|
||||
match mime.parse() {
|
||||
Ok(m) => Some(m),
|
||||
Err(_) => {
|
||||
err.issues.push(CLIError::Input(InputError::Mime(mime.to_string())));
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn arg_from_str<'a, T>(arg: &str,
|
||||
err: &mut InvalidOptionsError,
|
||||
arg_name: &'a str,
|
||||
arg_type: &'a str)
|
||||
-> T
|
||||
where T: FromStr + Default,
|
||||
<T as FromStr>::Err: fmt::Display
|
||||
{
|
||||
match FromStr::from_str(arg) {
|
||||
Err(perr) => {
|
||||
err.issues.push(CLIError::ParseError(arg_name.to_owned(),
|
||||
arg_type.to_owned(),
|
||||
arg.to_string(),
|
||||
format!("{}", perr)));
|
||||
Default::default()
|
||||
}
|
||||
Ok(v) => v,
|
||||
}
|
||||
}
|
||||
|
||||
pub struct JsonTokenStorage {
|
||||
pub program_name: &'static str,
|
||||
pub db_dir: String,
|
||||
}
|
||||
|
||||
impl JsonTokenStorage {
|
||||
fn path(&self, scope_hash: u64) -> PathBuf {
|
||||
Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TokenStorageError {
|
||||
Json(json::Error),
|
||||
Io(io::Error),
|
||||
}
|
||||
|
||||
impl fmt::Display for TokenStorageError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err),
|
||||
TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for TokenStorageError {
|
||||
fn description(&self) -> &str {
|
||||
"Failure when getting or setting the token storage"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl TokenStorage for JsonTokenStorage {
|
||||
type Error = TokenStorageError;
|
||||
|
||||
// NOTE: logging might be interesting, currently we swallow all errors
|
||||
fn set(&mut self,
|
||||
scope_hash: u64,
|
||||
_: &Vec<&str>,
|
||||
token: Option<Token>)
|
||||
-> Result<(), TokenStorageError> {
|
||||
match token {
|
||||
None => {
|
||||
match fs::remove_file(self.path(scope_hash)) {
|
||||
Err(err) => match err.kind() {
|
||||
io::ErrorKind::NotFound => Ok(()),
|
||||
_ => Err(TokenStorageError::Io(err)),
|
||||
},
|
||||
Ok(_) => Ok(()),
|
||||
}
|
||||
}
|
||||
Some(token) => {
|
||||
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
||||
Ok(mut f) => {
|
||||
match json::to_writer_pretty(&mut f, &token) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(serde_err) => Err(TokenStorageError::Json(serde_err)),
|
||||
}
|
||||
}
|
||||
Err(io_err) => Err(TokenStorageError::Io(io_err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, TokenStorageError> {
|
||||
match fs::File::open(&self.path(scope_hash)) {
|
||||
Ok(f) => {
|
||||
match json::de::from_reader(f) {
|
||||
Ok(token) => Ok(Some(token)),
|
||||
Err(err) => Err(TokenStorageError::Json(err)),
|
||||
}
|
||||
}
|
||||
Err(io_err) => {
|
||||
match io_err.kind() {
|
||||
io::ErrorKind::NotFound => Ok(None),
|
||||
_ => Err(TokenStorageError::Io(io_err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ApplicationSecretError {
|
||||
DecoderError((String, json::Error)),
|
||||
FormatError(String),
|
||||
}
|
||||
|
||||
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: {}.",
|
||||
path,
|
||||
err),
|
||||
ApplicationSecretError::FormatError(ref path) =>
|
||||
writeln!(f,
|
||||
"'installed' field is unset in secret file at '{}'.",
|
||||
path),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ConfigurationError {
|
||||
DirectoryCreationFailed((String, io::Error)),
|
||||
DirectoryUnset,
|
||||
HomeExpansionFailed(String),
|
||||
Secret(ApplicationSecretError),
|
||||
Io((String, io::Error)),
|
||||
}
|
||||
|
||||
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),
|
||||
ConfigurationError::DirectoryUnset => 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),
|
||||
ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err),
|
||||
ConfigurationError::Io((ref path, ref err)) =>
|
||||
writeln!(f,
|
||||
"IO operation failed on path '{}' with error: {}.",
|
||||
path,
|
||||
err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InputError {
|
||||
Io((String, io::Error)),
|
||||
Mime(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for InputError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
InputError::Io((ref file_path, ref 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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum FieldError {
|
||||
PopOnEmpty(String),
|
||||
TrailingFieldSep(String),
|
||||
Unknown(String, Option<String>, Option<String>),
|
||||
Duplicate(String),
|
||||
Empty,
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
FieldError::TrailingFieldSep(ref 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::Duplicate(ref cursor) =>
|
||||
writeln!(f, "Value at '{}' was already set", cursor),
|
||||
FieldError::Empty => writeln!(f, "Field names must not be empty."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CLIError {
|
||||
Configuration(ConfigurationError),
|
||||
ParseError(String, String, 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 {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
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::InvalidUploadProtocol(ref proto_name, ref valid_names) =>
|
||||
writeln!(f,
|
||||
"'{}' is not a valid upload protocol. Choose from one of {}.",
|
||||
proto_name,
|
||||
valid_names.join(", ")),
|
||||
CLIError::ParseError(ref arg_name, ref 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, ref possible_values) => {
|
||||
let 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)
|
||||
}
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct InvalidOptionsError {
|
||||
pub issues: Vec<CLIError>,
|
||||
pub exit_code: i32,
|
||||
}
|
||||
|
||||
impl fmt::Display for InvalidOptionsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
for issue in &self.issues {
|
||||
try!(issue.fmt(f));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl InvalidOptionsError {
|
||||
pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError {
|
||||
InvalidOptionsError {
|
||||
issues: vec![err],
|
||||
exit_code: exit_code,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new() -> InvalidOptionsError {
|
||||
InvalidOptionsError {
|
||||
issues: Vec::new(),
|
||||
exit_code: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
|
||||
let trdir = dir.trim();
|
||||
if trdir.len() == 0 {
|
||||
return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset));
|
||||
}
|
||||
|
||||
let expanded_config_dir = if trdir.as_bytes()[0] == b'~' {
|
||||
match env::var("HOME").ok().or(env::var("UserProfile").ok()) {
|
||||
None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))),
|
||||
Some(mut user) => {
|
||||
user.push_str(&trdir[1..]);
|
||||
user
|
||||
}
|
||||
}
|
||||
} else {
|
||||
trdir.to_string()
|
||||
};
|
||||
|
||||
if let Err(err) = fs::create_dir(&expanded_config_dir) {
|
||||
if err.kind() != io::ErrorKind::AlreadyExists {
|
||||
return Err(CLIError::Configuration(
|
||||
ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err))));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(expanded_config_dir)
|
||||
}
|
||||
|
||||
pub fn application_secret_from_directory(dir: &str,
|
||||
secret_basename: &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();
|
||||
let secret_io_error = |io_err: io::Error| {
|
||||
Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err))))
|
||||
};
|
||||
|
||||
for _ in 0..2 {
|
||||
match fs::File::open(&secret_path) {
|
||||
Err(mut err) => {
|
||||
if err.kind() == io::ErrorKind::NotFound {
|
||||
// Write our built-in one - user may adjust the written file at will
|
||||
|
||||
err = match fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
.open(&secret_path) {
|
||||
Err(cfe) => cfe,
|
||||
Ok(mut f) => {
|
||||
// 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(serde_err) =>
|
||||
panic!("Unexpected serde error: {:#?}", serde_err),
|
||||
Ok(_) => continue,
|
||||
}
|
||||
}
|
||||
};
|
||||
// fall through to IO error handling
|
||||
}
|
||||
return secret_io_error(err);
|
||||
}
|
||||
Ok(f) => {
|
||||
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||
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())
|
||||
))),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unreachable!();
|
||||
}
|
||||
33676
gen/compute1-cli/src/main.rs
Normal file
33676
gen/compute1-cli/src/main.rs
Normal file
File diff suppressed because it is too large
Load Diff
31
gen/compute1/Cargo.toml
Normal file
31
gen/compute1/Cargo.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
# DO NOT EDIT !
|
||||
# This file was generated automatically from 'src/mako/Cargo.toml.mako'
|
||||
# DO NOT EDIT !
|
||||
[package]
|
||||
|
||||
name = "google-compute1"
|
||||
version = "1.0.7+20171122"
|
||||
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"
|
||||
homepage = "https://developers.google.com/compute/docs/reference/latest/"
|
||||
documentation = "https://docs.rs/google-compute1/1.0.7+20171122"
|
||||
license = "MIT"
|
||||
keywords = ["compute", "google", "protocol", "web", "api"]
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
hyper-rustls = "^0.6"
|
||||
|
||||
[dependencies]
|
||||
hyper = "^ 0.10"
|
||||
mime = "^ 0.2.0"
|
||||
serde = "^ 1.0"
|
||||
serde_json = "^ 1.0"
|
||||
serde_derive = "^ 1.0"
|
||||
yup-oauth2 = "^ 1.0"
|
||||
url = "= 0.5"
|
||||
|
||||
[features]
|
||||
|
||||
|
||||
30
gen/compute1/LICENSE.md
Normal file
30
gen/compute1/LICENSE.md
Normal file
@@ -0,0 +1,30 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/LICENSE.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © `2015-2016` `Sebastian Thiel`
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
442
gen/compute1/README.md
Normal file
442
gen/compute1/README.md
Normal file
@@ -0,0 +1,442 @@
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/api/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `google-compute1` library allows access to all features of the *Google compute* service.
|
||||
|
||||
This documentation was generated from *compute* crate version *1.0.7+20171122*, where *20171122* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.7*.
|
||||
|
||||
Everything else about the *compute* *v1* API can be found at the
|
||||
[official documentation site](https://developers.google.com/compute/docs/reference/latest/).
|
||||
# Features
|
||||
|
||||
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Compute.html) ...
|
||||
|
||||
* [accelerator types](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AcceleratorType.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AcceleratorTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AcceleratorTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AcceleratorTypeListCall.html)
|
||||
* addresses
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AddresseAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AddresseListCall.html)
|
||||
* [autoscalers](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Autoscaler.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.AutoscalerUpdateCall.html)
|
||||
* [backend buckets](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucket.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendBucketUpdateCall.html)
|
||||
* [backend services](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendService.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServicePatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.BackendServiceUpdateCall.html)
|
||||
* [disk types](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskType.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskTypeListCall.html)
|
||||
* [disks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Disk.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskAggregatedListCall.html), [*create snapshot*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskCreateSnapshotCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskListCall.html), [*resize*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskResizeCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.DiskSetLabelCall.html)
|
||||
* [firewalls](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Firewall.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.FirewallUpdateCall.html)
|
||||
* [forwarding rules](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRule.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ForwardingRuleSetTargetCall.html)
|
||||
* global addresses
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalAddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalAddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalAddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalAddresseListCall.html)
|
||||
* global forwarding rules
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalForwardingRuleSetTargetCall.html)
|
||||
* global operations
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalOperationAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.GlobalOperationListCall.html)
|
||||
* [health checks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheck.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HealthCheckUpdateCall.html)
|
||||
* [http health checks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheck.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpHealthCheckUpdateCall.html)
|
||||
* [https health checks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheck.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.HttpsHealthCheckUpdateCall.html)
|
||||
* [images](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Image.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageDeleteCall.html), [*deprecate*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageDeprecateCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageGetCall.html), [*get from family*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageGetFromFamilyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageListCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ImageSetLabelCall.html)
|
||||
* [instance group managers](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManager.html)
|
||||
* [*abandon instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerAbandonInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupManagerSetTargetPoolCall.html)
|
||||
* [instance groups](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroup.html)
|
||||
* [*add instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupListInstanceCall.html), [*remove instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupRemoveInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGroupSetNamedPortCall.html)
|
||||
* [instance templates](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceTemplate.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceTemplateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceTemplateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceTemplateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceTemplateListCall.html)
|
||||
* [instances](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Instance.html)
|
||||
* [*add access config*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceAddAccessConfigCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceAggregatedListCall.html), [*attach disk*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceAttachDiskCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceDeleteCall.html), [*delete access config*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceDetachDiskCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGetCall.html), [*get serial port output*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceGetSerialPortOutputCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceListCall.html), [*reset*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceResetCall.html), [*set deletion protection*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetDeletionProtectionCall.html), [*set disk auto delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetDiskAutoDeleteCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetLabelCall.html), [*set machine resources*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetMachineResourceCall.html), [*set machine type*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetMachineTypeCall.html), [*set metadata*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetMetadataCall.html), [*set min cpu platform*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetMinCpuPlatformCall.html), [*set scheduling*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetSchedulingCall.html), [*set service account*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetServiceAccountCall.html), [*set tags*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceSetTagCall.html), [*start*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceStartCall.html), [*start with encryption key*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceStartWithEncryptionKeyCall.html) and [*stop*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InstanceStopCall.html)
|
||||
* [interconnect attachments](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachment.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachmentAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachmentDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachmentInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectAttachmentListCall.html)
|
||||
* [interconnect locations](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectLocation.html)
|
||||
* [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectLocationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectLocationListCall.html)
|
||||
* [interconnects](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Interconnect.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectListCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.InterconnectPatchCall.html)
|
||||
* [licenses](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.License.html)
|
||||
* [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.LicenseGetCall.html)
|
||||
* [machine types](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.MachineType.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.MachineTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.MachineTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.MachineTypeListCall.html)
|
||||
* [networks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Network.html)
|
||||
* [*add peering*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkAddPeeringCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkPatchCall.html), [*remove peering*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkRemovePeeringCall.html) and [*switch to custom mode*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.NetworkSwitchToCustomModeCall.html)
|
||||
* [projects](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Project.html)
|
||||
* [*disable xpn host*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectDisableXpnHostCall.html), [*disable xpn resource*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectDisableXpnResourceCall.html), [*enable xpn host*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectEnableXpnHostCall.html), [*enable xpn resource*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectEnableXpnResourceCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectGetCall.html), [*get xpn host*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectGetXpnHostCall.html), [*get xpn resources*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectGetXpnResourceCall.html), [*list xpn hosts*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectListXpnHostCall.html), [*move disk*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectMoveDiskCall.html), [*move instance*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectMoveInstanceCall.html), [*set common instance metadata*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectSetCommonInstanceMetadataCall.html) and [*set usage export bucket*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ProjectSetUsageExportBucketCall.html)
|
||||
* region autoscalers
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionAutoscalerUpdateCall.html)
|
||||
* region backend services
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServicePatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionBackendServiceUpdateCall.html)
|
||||
* region commitments
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionCommitmentAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionCommitmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionCommitmentInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionCommitmentListCall.html)
|
||||
* region instance group managers
|
||||
* [*abandon instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerAbandonInstanceCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupManagerSetTargetPoolCall.html)
|
||||
* region instance groups
|
||||
* [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupGetCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupListInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionInstanceGroupSetNamedPortCall.html)
|
||||
* region operations
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionOperationListCall.html)
|
||||
* [regions](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Region.html)
|
||||
* [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RegionListCall.html)
|
||||
* [routers](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Router.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterGetCall.html), [*get router status*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterGetRouterStatuCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterPatchCall.html), [*preview*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterPreviewCall.html) and [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouterUpdateCall.html)
|
||||
* [routes](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Route.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouteDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouteGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouteInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.RouteListCall.html)
|
||||
* [snapshots](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Snapshot.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SnapshotDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SnapshotGetCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SnapshotListCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SnapshotSetLabelCall.html)
|
||||
* [ssl certificates](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SslCertificate.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SslCertificateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SslCertificateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SslCertificateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SslCertificateListCall.html)
|
||||
* [subnetworks](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Subnetwork.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkDeleteCall.html), [*expand ip cidr range*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkExpandIpCidrRangeCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkListCall.html) and [*set private ip google access*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.SubnetworkSetPrivateIpGoogleAccesCall.html)
|
||||
* [target http proxies](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxy.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxyListCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpProxySetUrlMapCall.html)
|
||||
* [target https proxies](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxy.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxyListCall.html), [*set ssl certificates*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxySetSslCertificateCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetHttpsProxySetUrlMapCall.html)
|
||||
* [target instances](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstance.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstanceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstanceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstanceGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstanceInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetInstanceListCall.html)
|
||||
* [target pools](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPool.html)
|
||||
* [*add health check*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolAddHealthCheckCall.html), [*add instance*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolListCall.html), [*remove health check*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolRemoveHealthCheckCall.html), [*remove instance*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolRemoveInstanceCall.html) and [*set backup*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetPoolSetBackupCall.html)
|
||||
* [target ssl proxies](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxy.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxySetBackendServiceCall.html), [*set proxy header*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxySetProxyHeaderCall.html) and [*set ssl certificates*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetSslProxySetSslCertificateCall.html)
|
||||
* [target tcp proxies](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxy.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxySetBackendServiceCall.html) and [*set proxy header*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetTcpProxySetProxyHeaderCall.html)
|
||||
* [target vpn gateways](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGateway.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGatewayAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGatewayDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGatewayGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGatewayInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.TargetVpnGatewayListCall.html)
|
||||
* [url maps](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMap.html)
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapInsertCall.html), [*invalidate cache*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapInvalidateCacheCall.html), [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapPatchCall.html), [*update*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapUpdateCall.html) and [*validate*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.UrlMapValidateCall.html)
|
||||
* [vpn tunnels](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnel.html)
|
||||
* [*aggregated list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnelAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnelDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnelGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnelInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.VpnTunnelListCall.html)
|
||||
* zone operations
|
||||
* [*delete*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ZoneOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ZoneOperationListCall.html)
|
||||
* [zones](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Zone.html)
|
||||
* [*get*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ZoneGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.ZoneListCall.html)
|
||||
|
||||
|
||||
|
||||
|
||||
# Structure of this Library
|
||||
|
||||
The API is structured into the following primary items:
|
||||
|
||||
* **[Hub](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/struct.Compute.html)**
|
||||
* a central object to maintain state and allow accessing all *Activities*
|
||||
* creates [*Method Builders*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.MethodsBuilder.html) which in turn
|
||||
allow access to individual [*Call Builders*](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.CallBuilder.html)
|
||||
* **[Resources](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Resource.html)**
|
||||
* primary types that you can apply *Activities* to
|
||||
* a collection of properties and *Parts*
|
||||
* **[Parts](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Part.html)**
|
||||
* a collection of properties
|
||||
* never directly used in *Activities*
|
||||
* **[Activities](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.CallBuilder.html)**
|
||||
* operations to apply to *Resources*
|
||||
|
||||
All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||
|
||||
Generally speaking, you can invoke *Activities* like this:
|
||||
|
||||
```Rust,ignore
|
||||
let r = hub.resource().activity(...).doit()
|
||||
```
|
||||
|
||||
Or specifically ...
|
||||
|
||||
```ignore
|
||||
let r = hub.backend_buckets().delete(...).doit()
|
||||
let r = hub.instance_group_managers().resize(...).doit()
|
||||
let r = hub.ssl_certificates().delete(...).doit()
|
||||
let r = hub.autoscalers().patch(...).doit()
|
||||
let r = hub.region_autoscalers().delete(...).doit()
|
||||
let r = hub.region_backend_services().delete(...).doit()
|
||||
let r = hub.interconnects().delete(...).doit()
|
||||
let r = hub.firewalls().patch(...).doit()
|
||||
let r = hub.vpn_tunnels().delete(...).doit()
|
||||
let r = hub.backend_services().delete(...).doit()
|
||||
let r = hub.https_health_checks().delete(...).doit()
|
||||
let r = hub.projects().disable_xpn_host(...).doit()
|
||||
let r = hub.instances().set_service_account(...).doit()
|
||||
let r = hub.global_forwarding_rules().delete(...).doit()
|
||||
let r = hub.vpn_tunnels().insert(...).doit()
|
||||
let r = hub.disks().delete(...).doit()
|
||||
let r = hub.instance_groups().add_instances(...).doit()
|
||||
let r = hub.target_http_proxies().delete(...).doit()
|
||||
let r = hub.health_checks().patch(...).doit()
|
||||
let r = hub.instances().set_scheduling(...).doit()
|
||||
let r = hub.instances().delete(...).doit()
|
||||
let r = hub.target_pools().add_health_check(...).doit()
|
||||
let r = hub.instance_group_managers().insert(...).doit()
|
||||
let r = hub.global_addresses().insert(...).doit()
|
||||
let r = hub.target_ssl_proxies().set_ssl_certificates(...).doit()
|
||||
let r = hub.global_forwarding_rules().set_target(...).doit()
|
||||
let r = hub.autoscalers().insert(...).doit()
|
||||
let r = hub.instance_groups().insert(...).doit()
|
||||
let r = hub.subnetworks().insert(...).doit()
|
||||
let r = hub.routes().insert(...).doit()
|
||||
let r = hub.disks().resize(...).doit()
|
||||
let r = hub.target_tcp_proxies().delete(...).doit()
|
||||
let r = hub.target_ssl_proxies().set_backend_service(...).doit()
|
||||
let r = hub.instance_group_managers().set_instance_template(...).doit()
|
||||
let r = hub.networks().remove_peering(...).doit()
|
||||
let r = hub.interconnect_attachments().delete(...).doit()
|
||||
let r = hub.target_pools().insert(...).doit()
|
||||
let r = hub.instance_groups().set_named_ports(...).doit()
|
||||
let r = hub.projects().disable_xpn_resource(...).doit()
|
||||
let r = hub.instances().set_disk_auto_delete(...).doit()
|
||||
let r = hub.region_instance_group_managers().recreate_instances(...).doit()
|
||||
let r = hub.instance_group_managers().set_target_pools(...).doit()
|
||||
let r = hub.disks().insert(...).doit()
|
||||
let r = hub.target_ssl_proxies().delete(...).doit()
|
||||
let r = hub.region_backend_services().insert(...).doit()
|
||||
let r = hub.https_health_checks().insert(...).doit()
|
||||
let r = hub.target_pools().remove_health_check(...).doit()
|
||||
let r = hub.target_https_proxies().set_url_map(...).doit()
|
||||
let r = hub.instances().set_machine_type(...).doit()
|
||||
let r = hub.url_maps().insert(...).doit()
|
||||
let r = hub.instances().add_access_config(...).doit()
|
||||
let r = hub.instances().set_machine_resources(...).doit()
|
||||
let r = hub.addresses().insert(...).doit()
|
||||
let r = hub.health_checks().insert(...).doit()
|
||||
let r = hub.global_forwarding_rules().insert(...).doit()
|
||||
let r = hub.target_https_proxies().delete(...).doit()
|
||||
let r = hub.target_tcp_proxies().insert(...).doit()
|
||||
let r = hub.global_operations().get(...).doit()
|
||||
let r = hub.addresses().delete(...).doit()
|
||||
let r = hub.target_vpn_gateways().insert(...).doit()
|
||||
let r = hub.target_tcp_proxies().set_backend_service(...).doit()
|
||||
let r = hub.disks().create_snapshot(...).doit()
|
||||
let r = hub.health_checks().update(...).doit()
|
||||
let r = hub.instance_groups().remove_instances(...).doit()
|
||||
let r = hub.instances().set_metadata(...).doit()
|
||||
let r = hub.region_commitments().insert(...).doit()
|
||||
let r = hub.forwarding_rules().insert(...).doit()
|
||||
let r = hub.instances().start(...).doit()
|
||||
let r = hub.instance_group_managers().delete(...).doit()
|
||||
let r = hub.instances().set_deletion_protection(...).doit()
|
||||
let r = hub.subnetworks().expand_ip_cidr_range(...).doit()
|
||||
let r = hub.forwarding_rules().set_target(...).doit()
|
||||
let r = hub.projects().move_disk(...).doit()
|
||||
let r = hub.interconnects().patch(...).doit()
|
||||
let r = hub.firewalls().insert(...).doit()
|
||||
let r = hub.disks().set_labels(...).doit()
|
||||
let r = hub.target_pools().set_backup(...).doit()
|
||||
let r = hub.instance_group_managers().delete_instances(...).doit()
|
||||
let r = hub.region_instance_group_managers().delete_instances(...).doit()
|
||||
let r = hub.instances().detach_disk(...).doit()
|
||||
let r = hub.instance_groups().delete(...).doit()
|
||||
let r = hub.instances().delete_access_config(...).doit()
|
||||
let r = hub.target_https_proxies().set_ssl_certificates(...).doit()
|
||||
let r = hub.networks().insert(...).doit()
|
||||
let r = hub.instance_group_managers().abandon_instances(...).doit()
|
||||
let r = hub.instances().set_tags(...).doit()
|
||||
let r = hub.snapshots().delete(...).doit()
|
||||
let r = hub.target_https_proxies().insert(...).doit()
|
||||
let r = hub.target_tcp_proxies().set_proxy_header(...).doit()
|
||||
let r = hub.backend_services().update(...).doit()
|
||||
let r = hub.instance_group_managers().recreate_instances(...).doit()
|
||||
let r = hub.instances().attach_disk(...).doit()
|
||||
let r = hub.projects().set_common_instance_metadata(...).doit()
|
||||
let r = hub.region_operations().get(...).doit()
|
||||
let r = hub.backend_buckets().insert(...).doit()
|
||||
let r = hub.backend_services().patch(...).doit()
|
||||
let r = hub.target_http_proxies().set_url_map(...).doit()
|
||||
let r = hub.region_instance_group_managers().delete(...).doit()
|
||||
let r = hub.images().deprecate(...).doit()
|
||||
let r = hub.http_health_checks().patch(...).doit()
|
||||
let r = hub.images().insert(...).doit()
|
||||
let r = hub.url_maps().invalidate_cache(...).doit()
|
||||
let r = hub.region_autoscalers().insert(...).doit()
|
||||
let r = hub.ssl_certificates().insert(...).doit()
|
||||
let r = hub.interconnects().insert(...).doit()
|
||||
let r = hub.networks().switch_to_custom_mode(...).doit()
|
||||
let r = hub.projects().enable_xpn_resource(...).doit()
|
||||
let r = hub.projects().move_instance(...).doit()
|
||||
let r = hub.autoscalers().delete(...).doit()
|
||||
let r = hub.instance_templates().delete(...).doit()
|
||||
let r = hub.snapshots().set_labels(...).doit()
|
||||
let r = hub.https_health_checks().update(...).doit()
|
||||
let r = hub.region_autoscalers().patch(...).doit()
|
||||
let r = hub.url_maps().patch(...).doit()
|
||||
let r = hub.subnetworks().delete(...).doit()
|
||||
let r = hub.instances().stop(...).doit()
|
||||
let r = hub.target_pools().add_instance(...).doit()
|
||||
let r = hub.target_pools().remove_instance(...).doit()
|
||||
let r = hub.target_pools().delete(...).doit()
|
||||
let r = hub.firewalls().update(...).doit()
|
||||
let r = hub.instances().insert(...).doit()
|
||||
let r = hub.projects().set_usage_export_bucket(...).doit()
|
||||
let r = hub.region_backend_services().patch(...).doit()
|
||||
let r = hub.images().set_labels(...).doit()
|
||||
let r = hub.target_instances().insert(...).doit()
|
||||
let r = hub.target_http_proxies().insert(...).doit()
|
||||
let r = hub.interconnect_attachments().insert(...).doit()
|
||||
let r = hub.networks().patch(...).doit()
|
||||
let r = hub.url_maps().update(...).doit()
|
||||
let r = hub.region_instance_groups().set_named_ports(...).doit()
|
||||
let r = hub.instance_templates().insert(...).doit()
|
||||
let r = hub.target_instances().delete(...).doit()
|
||||
let r = hub.region_instance_group_managers().set_instance_template(...).doit()
|
||||
let r = hub.projects().enable_xpn_host(...).doit()
|
||||
let r = hub.routers().delete(...).doit()
|
||||
let r = hub.region_instance_group_managers().resize(...).doit()
|
||||
let r = hub.target_vpn_gateways().delete(...).doit()
|
||||
let r = hub.health_checks().delete(...).doit()
|
||||
let r = hub.instances().set_labels(...).doit()
|
||||
let r = hub.region_backend_services().update(...).doit()
|
||||
let r = hub.backend_buckets().patch(...).doit()
|
||||
let r = hub.global_addresses().delete(...).doit()
|
||||
let r = hub.https_health_checks().patch(...).doit()
|
||||
let r = hub.networks().delete(...).doit()
|
||||
let r = hub.url_maps().delete(...).doit()
|
||||
let r = hub.routers().insert(...).doit()
|
||||
let r = hub.instances().reset(...).doit()
|
||||
let r = hub.routers().update(...).doit()
|
||||
let r = hub.routers().patch(...).doit()
|
||||
let r = hub.networks().add_peering(...).doit()
|
||||
let r = hub.backend_services().insert(...).doit()
|
||||
let r = hub.target_ssl_proxies().set_proxy_header(...).doit()
|
||||
let r = hub.http_health_checks().delete(...).doit()
|
||||
let r = hub.http_health_checks().insert(...).doit()
|
||||
let r = hub.images().delete(...).doit()
|
||||
let r = hub.region_instance_group_managers().abandon_instances(...).doit()
|
||||
let r = hub.subnetworks().set_private_ip_google_access(...).doit()
|
||||
let r = hub.autoscalers().update(...).doit()
|
||||
let r = hub.region_instance_group_managers().set_target_pools(...).doit()
|
||||
let r = hub.region_autoscalers().update(...).doit()
|
||||
let r = hub.target_ssl_proxies().insert(...).doit()
|
||||
let r = hub.instances().start_with_encryption_key(...).doit()
|
||||
let r = hub.instances().set_min_cpu_platform(...).doit()
|
||||
let r = hub.forwarding_rules().delete(...).doit()
|
||||
let r = hub.backend_buckets().update(...).doit()
|
||||
let r = hub.firewalls().delete(...).doit()
|
||||
let r = hub.zone_operations().get(...).doit()
|
||||
let r = hub.http_health_checks().update(...).doit()
|
||||
let r = hub.routes().delete(...).doit()
|
||||
let r = hub.region_instance_group_managers().insert(...).doit()
|
||||
```
|
||||
|
||||
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
||||
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
|
||||
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
|
||||
The `doit()` method performs the actual communication with the server and returns the respective result.
|
||||
|
||||
# Usage
|
||||
|
||||
## Setting up your Project
|
||||
|
||||
To use this library, you would put the following lines into your `Cargo.toml` file:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
google-compute1 = "*"
|
||||
```
|
||||
|
||||
## A complete example
|
||||
|
||||
```Rust
|
||||
extern crate hyper;
|
||||
extern crate hyper_rustls;
|
||||
extern crate yup_oauth2 as oauth2;
|
||||
extern crate google_compute1 as compute1;
|
||||
use compute1::{Result, Error};
|
||||
use std::default::Default;
|
||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||
use compute1::Compute;
|
||||
|
||||
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
||||
// `client_secret`, among other things.
|
||||
let secret: ApplicationSecret = Default::default();
|
||||
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
|
||||
// unless you replace `None` with the desired Flow.
|
||||
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
|
||||
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
|
||||
// retrieve them from storage.
|
||||
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
||||
hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
|
||||
<MemoryStorage as Default>::default(), None);
|
||||
let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
|
||||
// You can configure optional parameters by calling the respective setters at will, and
|
||||
// execute the final call using `doit()`.
|
||||
// Values shown here are possibly random and not representative !
|
||||
let result = hub.instances().set_disk_auto_delete("project", "zone", "instance", true, "deviceName")
|
||||
.request_id("dolores")
|
||||
.doit();
|
||||
|
||||
match result {
|
||||
Err(e) => match e {
|
||||
// The Error enum provides details about what exactly happened.
|
||||
// You can also just use its `Debug`, `Display` or `Error` traits
|
||||
Error::HttpError(_)
|
||||
|Error::MissingAPIKey
|
||||
|Error::MissingToken(_)
|
||||
|Error::Cancelled
|
||||
|Error::UploadSizeLimitExceeded(_, _)
|
||||
|Error::Failure(_)
|
||||
|Error::BadRequest(_)
|
||||
|Error::FieldClash(_)
|
||||
|Error::JsonDecodeError(_, _) => println!("{}", e),
|
||||
},
|
||||
Ok(res) => println!("Success: {:?}", res),
|
||||
}
|
||||
|
||||
```
|
||||
## Handling Errors
|
||||
|
||||
All errors produced by the system are provided either as [Result](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/enum.Result.html) enumeration as return value of
|
||||
the doit() methods, or handed as possibly intermediate results to either the
|
||||
[Hub Delegate](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
|
||||
|
||||
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||
makes the system potentially resilient to all kinds of errors.
|
||||
|
||||
## Uploads and Downloads
|
||||
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/enum.Result.html), should be
|
||||
read by you to obtain the media.
|
||||
If such a method also supports a [Response Result](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.ResponseResult.html), it will return that by default.
|
||||
You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
|
||||
this call: `.param("alt", "media")`.
|
||||
|
||||
Methods supporting uploads can do so using up to 2 different protocols:
|
||||
*simple* and *resumable*. The distinctiveness of each is represented by customized
|
||||
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
|
||||
|
||||
## Customization and Callbacks
|
||||
|
||||
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Delegate.html) to the
|
||||
[Method Builder](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.CallBuilder.html) before making the final `doit()` call.
|
||||
Respective methods will be called to provide progress information, as well as determine whether the system should
|
||||
retry on failure.
|
||||
|
||||
The [delegate trait](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort.
|
||||
|
||||
## Optional Parts in Server-Requests
|
||||
|
||||
All structures provided by this library are made to be [enocodable](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.RequestValue.html) and
|
||||
[decodable](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||
are valid.
|
||||
Most optionals are are considered [Parts](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.Part.html) which are identifiable by name, which will be sent to
|
||||
the server to indicate either the set parts of the request or the desired parts in the response.
|
||||
|
||||
## Builder Arguments
|
||||
|
||||
Using [method builders](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods.
|
||||
These will always take a single argument, for which the following statements are true.
|
||||
|
||||
* [PODs][wiki-pod] are handed by copy
|
||||
* strings are passed as `&str`
|
||||
* [request values](https://docs.rs/google-compute1/1.0.7+20171122/google_compute1/trait.RequestValue.html) are moved
|
||||
|
||||
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||
|
||||
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
|
||||
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
||||
[google-go-api]: https://github.com/google/google-api-go-client
|
||||
|
||||
# License
|
||||
The **compute1** library was generated by Sebastian Thiel, and is placed
|
||||
under the *MIT* license.
|
||||
You can read the full text at the repository's [license file][repo-license].
|
||||
|
||||
[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md
|
||||
753
gen/compute1/src/cmn.rs
Normal file
753
gen/compute1/src/cmn.rs
Normal file
@@ -0,0 +1,753 @@
|
||||
// COPY OF 'src/rust/api/cmn.rs'
|
||||
// DO NOT EDIT
|
||||
use std::io::{self, Read, Seek, Cursor, Write, SeekFrom};
|
||||
use std;
|
||||
use std::fmt::{self, Display};
|
||||
use std::str::FromStr;
|
||||
use std::error;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
use mime::{Mime, TopLevel, SubLevel, Attr, Value};
|
||||
use oauth2::{TokenType, Retry, self};
|
||||
use hyper;
|
||||
use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header,
|
||||
HeaderFormat, Bearer};
|
||||
use hyper::http::h1::LINE_ENDING;
|
||||
use hyper::method::Method;
|
||||
use hyper::status::StatusCode;
|
||||
|
||||
use serde_json as json;
|
||||
|
||||
/// Identifies the Hub. There is only one per library, this trait is supposed
|
||||
/// to make intended use more explicit.
|
||||
/// The hub allows to access all resource methods more easily.
|
||||
pub trait Hub {}
|
||||
|
||||
/// Identifies types for building methods of a particular resource type
|
||||
pub trait MethodsBuilder {}
|
||||
|
||||
/// Identifies types which represent builders for a particular resource method
|
||||
pub trait CallBuilder {}
|
||||
|
||||
/// Identifies types which can be inserted and deleted.
|
||||
/// Types with this trait are most commonly used by clients of this API.
|
||||
pub trait Resource {}
|
||||
|
||||
/// Identifies types which are used in API responses.
|
||||
pub trait ResponseResult {}
|
||||
|
||||
/// Identifies types which are used in API requests.
|
||||
pub trait RequestValue {}
|
||||
|
||||
/// Identifies types which are not actually used by the API
|
||||
/// This might be a bug within the google API schema.
|
||||
pub trait UnusedType {}
|
||||
|
||||
/// Identifies types which are only used as part of other types, which
|
||||
/// usually are carrying the `Resource` trait.
|
||||
pub trait Part {}
|
||||
|
||||
/// Identifies types which are only used by other types internally.
|
||||
/// They have no special meaning, this trait just marks them for completeness.
|
||||
pub trait NestedType {}
|
||||
|
||||
/// A utility to specify reader types which provide seeking capabilities too
|
||||
pub trait ReadSeek: Seek + Read {}
|
||||
impl<T: Seek + Read> ReadSeek for T {}
|
||||
|
||||
/// A trait for all types that can convert themselves into a *parts* string
|
||||
pub trait ToParts {
|
||||
fn to_parts(&self) -> String;
|
||||
}
|
||||
|
||||
/// A utility type which can decode a server response that indicates error
|
||||
#[derive(Deserialize)]
|
||||
pub struct JsonServerError {
|
||||
pub error: String,
|
||||
pub error_description: Option<String>
|
||||
}
|
||||
|
||||
/// A utility to represent detailed errors we might see in case there are BadRequests.
|
||||
/// The latter happen if the sent parameters or request structures are unsound
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ErrorResponse {
|
||||
error: ServerError,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ServerError {
|
||||
errors: Vec<ServerMessage>,
|
||||
code: u16,
|
||||
message: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct ServerMessage {
|
||||
domain: String,
|
||||
reason: String,
|
||||
message: String,
|
||||
#[serde(rename="locationType")]
|
||||
location_type: Option<String>,
|
||||
location: Option<String>
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DummyNetworkStream;
|
||||
|
||||
impl Read for DummyNetworkStream {
|
||||
fn read(&mut self, _: &mut [u8]) -> io::Result<usize> {
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for DummyNetworkStream {
|
||||
fn write(&mut self, _: &[u8]) -> io::Result<usize> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl hyper::net::NetworkStream for DummyNetworkStream {
|
||||
fn peer_addr(&mut self) -> io::Result<std::net::SocketAddr> {
|
||||
Ok("127.0.0.1:1337".parse().unwrap())
|
||||
}
|
||||
|
||||
fn set_read_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_write_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// A trait specifying functionality to help controlling any request performed by the API.
|
||||
/// The trait has a conservative default implementation.
|
||||
///
|
||||
/// It contains methods to deal with all common issues, as well with the ones related to
|
||||
/// uploading media
|
||||
pub trait Delegate {
|
||||
|
||||
/// Called at the beginning of any API request. The delegate should store the method
|
||||
/// information if he is interesting in knowing more context when further calls to it
|
||||
/// are made.
|
||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||
/// between various API calls.
|
||||
fn begin(&mut self, MethodInfo) {}
|
||||
|
||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
///
|
||||
/// Return retry information.
|
||||
fn http_error(&mut self, &hyper::Error) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
|
||||
/// Called whenever there is the need for your applications API key after
|
||||
/// the official authenticator implementation didn't provide one, for some reason.
|
||||
/// If this method returns None as well, the underlying operation will fail
|
||||
fn api_key(&mut self) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Called whenever the Authenticator didn't yield a token. The delegate
|
||||
/// may attempt to provide one, or just take it as a general information about the
|
||||
/// impending failure.
|
||||
/// The given Error provides information about why the token couldn't be acquired in the
|
||||
/// first place
|
||||
fn token(&mut self, err: &error::Error) -> Option<oauth2::Token> {
|
||||
let _ = err;
|
||||
None
|
||||
}
|
||||
|
||||
/// Called during resumable uploads to provide a URL for the impending upload.
|
||||
/// It was saved after a previous call to `store_upload_url(...)`, and if not None,
|
||||
/// will be used instead of asking the server for a new upload URL.
|
||||
/// This is useful in case a previous resumable upload was aborted/canceled, but should now
|
||||
/// be resumed.
|
||||
/// The returned URL will be used exactly once - if it fails again and the delegate allows
|
||||
/// to retry, we will ask the server for a new upload URL.
|
||||
fn upload_url(&mut self) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
||||
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||||
/// see `upload_url()`.
|
||||
/// It will also be called with None after a successful upload, which allows the delegate
|
||||
/// to forget the URL. That way, we will not attempt to resume an upload that has already
|
||||
/// finished.
|
||||
fn store_upload_url(&mut self, url: Option<&str>) {
|
||||
let _ = url;
|
||||
}
|
||||
|
||||
/// Called whenever a server response could not be decoded from json.
|
||||
/// It's for informational purposes only, the caller will return with an error
|
||||
/// accordingly.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||
/// * `json_decode_error` - The decoder error
|
||||
fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) {
|
||||
let _ = json_encoded_value;
|
||||
let _ = json_decode_error;
|
||||
}
|
||||
|
||||
/// Called whenever the http request returns with a non-success status code.
|
||||
/// This can involve authentication issues, or anything else that very much
|
||||
/// depends on the used API method.
|
||||
/// The delegate should check the status, header and decoded json error to decide
|
||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||
///
|
||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
||||
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>, _: Option<ServerError>) -> Retry {
|
||||
Retry::Abort
|
||||
}
|
||||
|
||||
/// Called prior to sending the main request of the given method. It can be used to time
|
||||
/// the call or to print progress information.
|
||||
/// It's also useful as you can be sure that a request will definitely be made.
|
||||
fn pre_request(&mut self) { }
|
||||
|
||||
/// Return the size of each chunk of a resumable upload.
|
||||
/// Must be a power of two, with 1<<18 being the smallest allowed chunk size.
|
||||
/// Will be called once before starting any resumable upload.
|
||||
fn chunk_size(&mut self) -> u64 {
|
||||
1 << 23
|
||||
}
|
||||
|
||||
/// Called before the given chunk is uploaded to the server.
|
||||
/// If true is returned, the upload will be interrupted.
|
||||
/// However, it may be resumable if you stored the upload URL in a previous call
|
||||
/// to `store_upload_url()`
|
||||
fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool {
|
||||
let _ = chunk;
|
||||
false
|
||||
}
|
||||
|
||||
/// Called before the API request method returns, in every case. It can be used to clean up
|
||||
/// internal state between calls to the API.
|
||||
/// This call always has a matching call to `begin(...)`.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||
/// discard all values stored during `store_upload_url`.
|
||||
fn finished(&mut self, is_success: bool) {
|
||||
let _ = is_success;
|
||||
}
|
||||
}
|
||||
|
||||
/// A delegate with a conservative default implementation, which is used if no other delegate is
|
||||
/// set.
|
||||
#[derive(Default)]
|
||||
pub struct DefaultDelegate;
|
||||
|
||||
impl Delegate for DefaultDelegate {}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// The http connection failed
|
||||
HttpError(hyper::Error),
|
||||
|
||||
/// An attempt was made to upload a resource with size stored in field `.0`
|
||||
/// even though the maximum upload size is what is stored in field `.1`.
|
||||
UploadSizeLimitExceeded(u64, u64),
|
||||
|
||||
/// Represents information about a request that was not understood by the server.
|
||||
/// Details are included.
|
||||
BadRequest(ErrorResponse),
|
||||
|
||||
/// We needed an API key for authentication, but didn't obtain one.
|
||||
/// Neither through the authenticator, nor through the Delegate.
|
||||
MissingAPIKey,
|
||||
|
||||
/// We required a Token, but didn't get one from the Authenticator
|
||||
MissingToken(Box<error::Error>),
|
||||
|
||||
/// The delgate instructed to cancel the operation
|
||||
Cancelled,
|
||||
|
||||
/// An additional, free form field clashed with one of the built-in optional ones
|
||||
FieldClash(&'static str),
|
||||
|
||||
/// Shows that we failed to decode the server response.
|
||||
/// This can happen if the protocol changes in conjunction with strict json decoding.
|
||||
JsonDecodeError(String, json::Error),
|
||||
|
||||
/// Indicates an HTTP repsonse with a non-success status code
|
||||
Failure(hyper::client::Response),
|
||||
}
|
||||
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Error::HttpError(ref err) => err.fmt(f),
|
||||
Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) =>
|
||||
writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}"
|
||||
, resource_size, max_size),
|
||||
Error::MissingAPIKey => {
|
||||
(writeln!(f, "The application's API key was not found in the configuration")).ok();
|
||||
writeln!(f, "It is used as there are no Scopes defined for this method.")
|
||||
},
|
||||
Error::BadRequest(ref err) => {
|
||||
try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message));
|
||||
for err in err.error.errors.iter() {
|
||||
try!(writeln!(f, " {}: {}, {}{}",
|
||||
err.domain,
|
||||
err.message,
|
||||
err.reason,
|
||||
match &err.location {
|
||||
&Some(ref loc) => format!("@{}", loc),
|
||||
&None => String::new(),
|
||||
}));
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
Error::MissingToken(ref err) =>
|
||||
writeln!(f, "Token retrieval failed with error: {}", err),
|
||||
Error::Cancelled =>
|
||||
writeln!(f, "Operation cancelled by delegate"),
|
||||
Error::FieldClash(field) =>
|
||||
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
|
||||
Error::JsonDecodeError(ref json_str, ref err)
|
||||
=> writeln!(f, "{}: {}", err, json_str),
|
||||
Error::Failure(ref response) =>
|
||||
writeln!(f, "Http status indicates failure: {:?}", response),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
Error::HttpError(ref err) => err.description(),
|
||||
Error::JsonDecodeError(_, ref err) => err.description(),
|
||||
_ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead"
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
match *self {
|
||||
Error::HttpError(ref err) => err.cause(),
|
||||
Error::JsonDecodeError(_, ref err) => err.cause(),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A universal result type used as return for all calls.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Contains information about an API request.
|
||||
pub struct MethodInfo {
|
||||
pub id: &'static str,
|
||||
pub http_method: Method,
|
||||
}
|
||||
|
||||
const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d";
|
||||
|
||||
/// Provides a `Read` interface that converts multiple parts into the protocol
|
||||
/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387).
|
||||
/// **Note**: This implementation is just as rich as it needs to be to perform uploads
|
||||
/// to google APIs, and might not be a fully-featured implementation.
|
||||
#[derive(Default)]
|
||||
pub struct MultiPartReader<'a> {
|
||||
raw_parts: Vec<(Headers, &'a mut Read)>,
|
||||
current_part: Option<(Cursor<Vec<u8>>, &'a mut Read)>,
|
||||
last_part_boundary: Option<Cursor<Vec<u8>>>,
|
||||
}
|
||||
|
||||
impl<'a> MultiPartReader<'a> {
|
||||
|
||||
/// Reserve memory for exactly the given amount of parts
|
||||
pub fn reserve_exact(&mut self, cap: usize) {
|
||||
self.raw_parts.reserve_exact(cap);
|
||||
}
|
||||
|
||||
/// Add a new part to the queue of parts to be read on the first `read` call.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// `headers` - identifying the body of the part. It's similar to the header
|
||||
/// in an ordinary single-part call, and should thus contain the
|
||||
/// same information.
|
||||
/// `reader` - a reader providing the part's body
|
||||
/// `size` - the amount of bytes provided by the reader. It will be put onto the header as
|
||||
/// content-size.
|
||||
/// `mime` - It will be put onto the content type
|
||||
pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> {
|
||||
let mut headers = Headers::new();
|
||||
headers.set(ContentType(mime_type));
|
||||
headers.set(ContentLength(size));
|
||||
self.raw_parts.push((headers, reader));
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns the mime-type representing our multi-part message.
|
||||
/// Use it with the ContentType header.
|
||||
pub fn mime_type(&self) -> Mime {
|
||||
Mime(
|
||||
TopLevel::Multipart,
|
||||
SubLevel::Ext("Related".to_string()),
|
||||
vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))],
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns true if we are totally used
|
||||
fn is_depleted(&self) -> bool {
|
||||
self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none()
|
||||
}
|
||||
|
||||
/// Returns true if we are handling our last part
|
||||
fn is_last_part(&self) -> bool {
|
||||
self.raw_parts.len() == 0 && self.current_part.is_some()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Read for MultiPartReader<'a> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
match (self.raw_parts.len(),
|
||||
self.current_part.is_none(),
|
||||
self.last_part_boundary.is_none()) {
|
||||
(_, _, false) => {
|
||||
let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0);
|
||||
if br < buf.len() {
|
||||
self.last_part_boundary = None;
|
||||
}
|
||||
return Ok(br)
|
||||
},
|
||||
(0, true, true) => return Ok(0),
|
||||
(n, true, _) if n > 0 => {
|
||||
let (headers, reader) = self.raw_parts.remove(0);
|
||||
let mut c = Cursor::new(Vec::<u8>::new());
|
||||
(write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING,
|
||||
headers, LINE_ENDING)).unwrap();
|
||||
c.seek(SeekFrom::Start(0)).unwrap();
|
||||
self.current_part = Some((c, reader));
|
||||
}
|
||||
_ => {},
|
||||
}
|
||||
|
||||
// read headers as long as possible
|
||||
let (hb, rr) = {
|
||||
let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap();
|
||||
let b = c.read(buf).unwrap_or(0);
|
||||
(b, reader.read(&mut buf[b..]))
|
||||
};
|
||||
|
||||
match rr {
|
||||
Ok(bytes_read) => {
|
||||
if hb < buf.len() && bytes_read == 0 {
|
||||
if self.is_last_part() {
|
||||
// before clearing the last part, we will add the boundary that
|
||||
// will be written last
|
||||
self.last_part_boundary = Some(Cursor::new(
|
||||
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
|
||||
}
|
||||
// We are depleted - this can trigger the next part to come in
|
||||
self.current_part = None;
|
||||
}
|
||||
let mut total_bytes_read = hb + bytes_read;
|
||||
while total_bytes_read < buf.len() && !self.is_depleted() {
|
||||
match self.read(&mut buf[total_bytes_read ..]) {
|
||||
Ok(br) => total_bytes_read += br,
|
||||
Err(err) => return Err(err),
|
||||
}
|
||||
}
|
||||
Ok(total_bytes_read)
|
||||
}
|
||||
Err(err) => {
|
||||
// fail permanently
|
||||
self.current_part = None;
|
||||
self.last_part_boundary = None;
|
||||
self.raw_parts.clear();
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The `X-Upload-Content-Type` header.
|
||||
///
|
||||
/// Generated via rustc --pretty expanded -Z unstable-options, and manually
|
||||
/// processed to be more readable.
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct XUploadContentType(pub Mime);
|
||||
|
||||
impl ::std::ops::Deref for XUploadContentType {
|
||||
type Target = Mime;
|
||||
fn deref<'a>(&'a self) -> &'a Mime { &self.0 }
|
||||
}
|
||||
impl ::std::ops::DerefMut for XUploadContentType {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 }
|
||||
}
|
||||
impl Header for XUploadContentType {
|
||||
fn header_name() -> &'static str { "X-Upload-Content-Type" }
|
||||
fn parse_header(raw: &[Vec<u8>]) -> hyper::error::Result<Self> {
|
||||
hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType)
|
||||
}
|
||||
}
|
||||
impl HeaderFormat for XUploadContentType {
|
||||
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
Display::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
impl Display for XUploadContentType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::Display::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub struct Chunk {
|
||||
pub first: u64,
|
||||
pub last: u64
|
||||
}
|
||||
|
||||
impl fmt::Display for Chunk {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
(write!(fmt, "{}-{}", self.first, self.last)).ok();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Chunk {
|
||||
type Err = &'static str;
|
||||
|
||||
/// NOTE: only implements `%i-%i`, not `*`
|
||||
fn from_str(s: &str) -> std::result::Result<Chunk, &'static str> {
|
||||
let parts: Vec<&str> = s.split('-').collect();
|
||||
if parts.len() != 2 {
|
||||
return Err("Expected two parts: %i-%i")
|
||||
}
|
||||
Ok(
|
||||
Chunk {
|
||||
first: match FromStr::from_str(parts[0]) {
|
||||
Ok(d) => d,
|
||||
_ => return Err("Couldn't parse 'first' as digit")
|
||||
},
|
||||
last: match FromStr::from_str(parts[1]) {
|
||||
Ok(d) => d,
|
||||
_ => return Err("Couldn't parse 'last' as digit")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Implements the Content-Range header, for serialization only
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub struct ContentRange {
|
||||
pub range: Option<Chunk>,
|
||||
pub total_length: u64,
|
||||
}
|
||||
|
||||
impl Header for ContentRange {
|
||||
fn header_name() -> &'static str {
|
||||
"Content-Range"
|
||||
}
|
||||
|
||||
/// We are not parsable, as parsing is done by the `Range` header
|
||||
fn parse_header(_: &[Vec<u8>]) -> hyper::error::Result<Self> {
|
||||
Err(hyper::error::Error::Method)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl HeaderFormat for ContentRange {
|
||||
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(fmt.write_str("bytes "));
|
||||
match self.range {
|
||||
Some(ref c) => try!(c.fmt(fmt)),
|
||||
None => try!(fmt.write_str("*"))
|
||||
}
|
||||
(write!(fmt, "/{}", self.total_length)).ok();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub struct RangeResponseHeader(pub Chunk);
|
||||
|
||||
impl Header for RangeResponseHeader {
|
||||
fn header_name() -> &'static str {
|
||||
"Range"
|
||||
}
|
||||
|
||||
fn parse_header(raw: &[Vec<u8>]) -> hyper::error::Result<Self> {
|
||||
if raw.len() > 0 {
|
||||
let v = &raw[0];
|
||||
if let Ok(s) = std::str::from_utf8(v) {
|
||||
const PREFIX: &'static str = "bytes ";
|
||||
if s.starts_with(PREFIX) {
|
||||
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
|
||||
return Ok(RangeResponseHeader(c))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(hyper::error::Error::Method)
|
||||
}
|
||||
}
|
||||
|
||||
impl HeaderFormat for RangeResponseHeader {
|
||||
/// No implmentation necessary, we just need to parse
|
||||
fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
||||
Err(fmt::Error)
|
||||
}
|
||||
}
|
||||
|
||||
/// A utility type to perform a resumable upload from start to end.
|
||||
pub struct ResumableUploadHelper<'a, A: 'a> {
|
||||
pub client: &'a mut hyper::client::Client,
|
||||
pub delegate: &'a mut Delegate,
|
||||
pub start_at: Option<u64>,
|
||||
pub auth: &'a mut A,
|
||||
pub user_agent: &'a str,
|
||||
pub auth_header: Authorization<Bearer>,
|
||||
pub url: &'a str,
|
||||
pub reader: &'a mut ReadSeek,
|
||||
pub media_type: Mime,
|
||||
pub content_length: u64
|
||||
}
|
||||
|
||||
impl<'a, A> ResumableUploadHelper<'a, A>
|
||||
where A: oauth2::GetToken {
|
||||
|
||||
fn query_transfer_status(&mut self) -> std::result::Result<u64, hyper::Result<hyper::client::Response>> {
|
||||
loop {
|
||||
match self.client.post(self.url)
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
.header(ContentRange { range: None, total_length: self.content_length })
|
||||
.header(self.auth_header.clone())
|
||||
.send() {
|
||||
Ok(r) => {
|
||||
// 308 = resume-incomplete == PermanentRedirect
|
||||
let headers = r.headers.clone();
|
||||
let h: &RangeResponseHeader = match headers.get() {
|
||||
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
|
||||
None|Some(_) => {
|
||||
if let Retry::After(d) = self.delegate.http_failure(&r, None, None) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return Err(Ok(r))
|
||||
}
|
||||
};
|
||||
return Ok(h.0.last)
|
||||
}
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return Err(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// returns None if operation was cancelled by delegate, or the HttpResult.
|
||||
/// It can be that we return the result just because we didn't understand the status code -
|
||||
/// caller should check for status himself before assuming it's OK to use
|
||||
pub fn upload(&mut self) -> Option<hyper::Result<hyper::client::Response>> {
|
||||
let mut start = match self.start_at {
|
||||
Some(s) => s,
|
||||
None => match self.query_transfer_status() {
|
||||
Ok(s) => s,
|
||||
Err(result) => return Some(result)
|
||||
}
|
||||
};
|
||||
|
||||
const MIN_CHUNK_SIZE: u64 = 1 << 18;
|
||||
let chunk_size = match self.delegate.chunk_size() {
|
||||
cs if cs > MIN_CHUNK_SIZE => cs,
|
||||
_ => MIN_CHUNK_SIZE
|
||||
};
|
||||
|
||||
self.reader.seek(SeekFrom::Start(start)).unwrap();
|
||||
loop {
|
||||
let request_size = match self.content_length - start {
|
||||
rs if rs > chunk_size => chunk_size,
|
||||
rs => rs
|
||||
};
|
||||
|
||||
let mut section_reader = self.reader.take(request_size);
|
||||
let range_header = ContentRange {
|
||||
range: Some(Chunk {first: start, last: start + request_size - 1}),
|
||||
total_length: self.content_length
|
||||
};
|
||||
start += request_size;
|
||||
if self.delegate.cancel_chunk_upload(&range_header) {
|
||||
return None
|
||||
}
|
||||
let res = self.client.post(self.url)
|
||||
.header(range_header)
|
||||
.header(ContentType(self.media_type.clone()))
|
||||
.header(UserAgent(self.user_agent.to_string()))
|
||||
.body(&mut section_reader)
|
||||
.send();
|
||||
match res {
|
||||
Ok(mut res) => {
|
||||
if res.status == StatusCode::PermanentRedirect {
|
||||
continue
|
||||
}
|
||||
if !res.status.is_success() {
|
||||
let mut json_err = String::new();
|
||||
res.read_to_string(&mut json_err).unwrap();
|
||||
if let Retry::After(d) = self.delegate.http_failure(&res,
|
||||
json::from_str(&json_err).ok(),
|
||||
json::from_str(&json_err).ok()) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return Some(Ok(res))
|
||||
},
|
||||
Err(err) => {
|
||||
if let Retry::After(d) = self.delegate.http_error(&err) {
|
||||
sleep(d);
|
||||
continue;
|
||||
}
|
||||
return Some(Err(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy of src/rust/cli/cmn.rs
|
||||
// TODO(ST): Allow sharing common code between program types
|
||||
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);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
109020
gen/compute1/src/lib.rs
Normal file
109020
gen/compute1/src/lib.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user