The google-compute1
library allows access to all features of the Google compute service.
This documentation was generated from compute crate version 1.0.10+20190618, where 20190618 is the exact revision of the compute:v1 schema built by the mako code generator v1.0.10.
Everything else about the compute v1 API can be found at the official documentation site.
Features
Handle the following Resources with ease from the central hub ...
- accelerator types
- aggregated list, get and list
- addresses
- aggregated list, delete, get, insert and list
- autoscalers
- aggregated list, delete, get, insert, list, patch and update
- backend buckets
- add signed url key, delete, delete signed url key, get, insert, list, patch and update
- backend services
- add signed url key, aggregated list, delete, delete signed url key, get, get health, insert, list, patch, set security policy and update
- disk types
- aggregated list, get and list
- disks
- add resource policies, aggregated list, create snapshot, delete, get, get iam policy, insert, list, remove resource policies, resize, set iam policy, set labels and test iam permissions
- firewalls
- delete, get, insert, list, patch and update
- forwarding rules
- aggregated list, delete, get, insert, list and set target
- global addresses
- delete, get, insert and list
- global forwarding rules
- delete, get, insert, list and set target
- global operations
- aggregated list, delete, get and list
- health checks
- delete, get, insert, list, patch and update
- http health checks
- delete, get, insert, list, patch and update
- https health checks
- delete, get, insert, list, patch and update
- images
- delete, deprecate, get, get from family, get iam policy, insert, list, set iam policy, set labels and test iam permissions
- instance group managers
- abandon instances, aggregated list, delete, delete instances, get, insert, list, list managed instances, patch, recreate instances, resize, set instance template and set target pools
- instance groups
- add instances, aggregated list, delete, get, insert, list, list instances, remove instances and set named ports
- instance templates
- delete, get, get iam policy, insert, list, set iam policy and test iam permissions
- instances
- add access config, aggregated list, attach disk, delete, delete access config, detach disk, get, get guest attributes, get iam policy, get serial port output, get shielded instance identity, insert, list, list referrers, reset, set deletion protection, set disk auto delete, set iam policy, set labels, set machine resources, set machine type, set metadata, set min cpu platform, set scheduling, set service account, set shielded instance integrity policy, set tags, simulate maintenance event, start, start with encryption key, stop, test iam permissions, update access config, update network interface and update shielded instance config
- interconnect attachments
- aggregated list, delete, get, insert, list and patch
- interconnect locations
- get and list
- interconnects
- delete, get, get diagnostics, insert, list and patch
- license codes
- get and test iam permissions
- licenses
- delete, get, get iam policy, insert, list, set iam policy and test iam permissions
- machine types
- aggregated list, get and list
- network endpoint groups
- aggregated list, attach network endpoints, delete, detach network endpoints, get, insert, list, list network endpoints and test iam permissions
- networks
- add peering, delete, get, insert, list, patch, remove peering and switch to custom mode
- node groups
- add nodes, aggregated list, delete, delete nodes, get, get iam policy, insert, list, list nodes, set iam policy, set node template and test iam permissions
- node templates
- aggregated list, delete, get, get iam policy, insert, list, set iam policy and test iam permissions
- node types
- aggregated list, get and list
- projects
- disable xpn host, disable xpn resource, enable xpn host, enable xpn resource, get, get xpn host, get xpn resources, list xpn hosts, move disk, move instance, set common instance metadata, set default network tier and set usage export bucket
- region autoscalers
- delete, get, insert, list, patch and update
- region backend services
- delete, get, get health, insert, list, patch and update
- region commitments
- aggregated list, get, insert and list
- region disk types
- get and list
- region disks
- add resource policies, create snapshot, delete, get, insert, list, remove resource policies, resize, set labels and test iam permissions
- region instance group managers
- abandon instances, delete, delete instances, get, insert, list, list managed instances, patch, recreate instances, resize, set instance template and set target pools
- region instance groups
- get, list, list instances and set named ports
- region operations
- delete, get and list
- regions
- get and list
- reservations
- aggregated list, delete, get, get iam policy, insert, list, resize, set iam policy and test iam permissions
- resource policies
- aggregated list, delete, get, get iam policy, insert, list, set iam policy and test iam permissions
- routers
- aggregated list, delete, get, get nat mapping info, get router status, insert, list, patch, preview and update
- routes
- delete, get, insert and list
- security policies
- add rule, delete, get, get rule, insert, list, patch, patch rule and remove rule
- snapshots
- delete, get, get iam policy, list, set iam policy, set labels and test iam permissions
- ssl certificates
- delete, get, insert and list
- ssl policies
- delete, get, insert, list, list available features and patch
- subnetworks
- aggregated list, delete, expand ip cidr range, get, get iam policy, insert, list, list usable, patch, set iam policy, set private ip google access and test iam permissions
- target http proxies
- delete, get, insert, list and set url map
- target https proxies
- delete, get, insert, list, set quic override, set ssl certificates, set ssl policy and set url map
- target instances
- aggregated list, delete, get, insert and list
- target pools
- add health check, add instance, aggregated list, delete, get, get health, insert, list, remove health check, remove instance and set backup
- target ssl proxies
- delete, get, insert, list, set backend service, set proxy header, set ssl certificates and set ssl policy
- target tcp proxies
- delete, get, insert, list, set backend service and set proxy header
- target vpn gateways
- aggregated list, delete, get, insert and list
- url maps
- delete, get, insert, invalidate cache, list, patch, update and validate
- vpn tunnels
- aggregated list, delete, get, insert and list
- zone operations
- delete, get and list
- zones
- get and list
Structure of this Library
The API is structured into the following primary items:
- Hub
- a central object to maintain state and allow accessing all Activities
- creates Method Builders which in turn allow access to individual Call Builders
- Resources
- primary types that you can apply Activities to
- a collection of properties and Parts
- Parts
- a collection of properties
- never directly used in Activities
- Activities
- 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:
let r = hub.resource.activity.doit
Or specifically ...
let r = hub.backend_buckets().delete(...).doit()
let r = hub.target_ssl_proxies().set_ssl_policy(...).doit()
let r = hub.ssl_certificates().delete(...).doit()
let r = hub.region_disks().resize(...).doit()
let r = hub.autoscalers().patch(...).doit()
let r = hub.instance_group_managers().resize(...).doit()
let r = hub.instance_templates().delete(...).doit()
let r = hub.region_instance_group_managers().patch(...).doit()
let r = hub.url_maps().update(...).doit()
let r = hub.region_backend_services().delete(...).doit()
let r = hub.interconnects().delete(...).doit()
let r = hub.instances().update_shielded_instance_config(...).doit()
let r = hub.region_disks().add_resource_policies(...).doit()
let r = hub.vpn_tunnels().delete(...).doit()
let r = hub.region_disks().set_labels(...).doit()
let r = hub.instances().set_machine_type(...).doit()
let r = hub.https_health_checks().delete(...).doit()
let r = hub.node_groups().delete(...).doit()
let r = hub.ssl_policies().delete(...).doit()
let r = hub.ssl_policies().insert(...).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.networks().insert(...).doit()
let r = hub.disks().add_resource_policies(...).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.security_policies().add_rule(...).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.projects().set_default_network_tier(...).doit()
let r = hub.instance_group_managers().set_instance_template(...).doit()
let r = hub.node_groups().set_node_template(...).doit()
let r = hub.resource_policies().delete(...).doit()
let r = hub.region_autoscalers().delete(...).doit()
let r = hub.networks().remove_peering(...).doit()
let r = hub.ssl_policies().patch(...).doit()
let r = hub.interconnect_attachments().delete(...).doit()
let r = hub.firewalls().patch(...).doit()
let r = hub.target_pools().insert(...).doit()
let r = hub.node_templates().insert(...).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.instances().simulate_maintenance_event(...).doit()
let r = hub.target_pools().remove_health_check(...).doit()
let r = hub.backend_buckets().add_signed_url_key(...).doit()
let r = hub.target_https_proxies().set_url_map(...).doit()
let r = hub.region_disks().create_snapshot(...).doit()
let r = hub.backend_services().delete(...).doit()
let r = hub.instances().update_network_interface(...).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.instances().update_access_config(...).doit()
let r = hub.security_policies().insert(...).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.backend_services().add_signed_url_key(...).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.target_https_proxies().set_quic_override(...).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.backend_services().set_security_policy(...).doit()
let r = hub.region_instance_group_managers().delete_instances(...).doit()
let r = hub.instances().detach_disk(...).doit()
let r = hub.region_disks().insert(...).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.instance_groups().add_instances(...).doit()
let r = hub.instance_group_managers().abandon_instances(...).doit()
let r = hub.instances().set_tags(...).doit()
let r = hub.network_endpoint_groups().attach_network_endpoints(...).doit()
let r = hub.reservations().resize(...).doit()
let r = hub.snapshots().delete(...).doit()
let r = hub.target_https_proxies().insert(...).doit()
let r = hub.reservations().insert(...).doit()
let r = hub.target_tcp_proxies().set_proxy_header(...).doit()
let r = hub.backend_services().update(...).doit()
let r = hub.disks().remove_resource_policies(...).doit()
let r = hub.node_groups().delete_nodes(...).doit()
let r = hub.licenses().delete(...).doit()
let r = hub.region_disks().remove_resource_policies(...).doit()
let r = hub.instance_group_managers().patch(...).doit()
let r = hub.subnetworks().patch(...).doit()
let r = hub.reservations().delete(...).doit()
let r = hub.target_https_proxies().set_ssl_policy(...).doit()
let r = hub.instances().attach_disk(...).doit()
let r = hub.projects().set_common_instance_metadata(...).doit()
let r = hub.node_templates().delete(...).doit()
let r = hub.region_operations().get(...).doit()
let r = hub.node_groups().add_nodes(...).doit()
let r = hub.backend_buckets().insert(...).doit()
let r = hub.node_groups().insert(...).doit()
let r = hub.licenses().insert(...).doit()
let r = hub.backend_services().patch(...).doit()
let r = hub.target_http_proxies().set_url_map(...).doit()
let r = hub.network_endpoint_groups().delete(...).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.region_autoscalers().insert(...).doit()
let r = hub.security_policies().patch_rule(...).doit()
let r = hub.interconnect_attachments().patch(...).doit()
let r = hub.images().insert(...).doit()
let r = hub.backend_buckets().delete_signed_url_key(...).doit()
let r = hub.url_maps().invalidate_cache(...).doit()
let r = hub.instance_groups().set_named_ports(...).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.security_policies().patch(...).doit()
let r = hub.autoscalers().delete(...).doit()
let r = hub.snapshots().set_labels(...).doit()
let r = hub.instance_group_managers().recreate_instances(...).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.region_disks().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.network_endpoint_groups().detach_network_endpoints(...).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.resource_policies().insert(...).doit()
let r = hub.security_policies().remove_rule(...).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.forwarding_rules().set_target(...).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.backend_services().insert(...).doit()
let r = hub.instances().set_labels(...).doit()
let r = hub.region_backend_services().update(...).doit()
let r = hub.instances().set_shielded_instance_integrity_policy(...).doit()
let r = hub.target_http_proxies().delete(...).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.security_policies().delete(...).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.network_endpoint_groups().insert(...).doit()
let r = hub.backend_buckets().update(...).doit()
let r = hub.region_instance_group_managers().insert(...).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.backend_services().delete_signed_url_key(...).doit()
The resource()
and activity(...)
calls create builders. 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 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:
[]
= "*"
# This project intentionally uses an old version of Hyper. See
# https://github.com/Byron/google-apis-rs/issues/173 for more
# information.
= "^0.10"
= "^0.6"
= "^1.0"
= "^1.0"
= "^1.0"
A complete example
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
extern crate google_compute1 as compute1;
use ;
use Default;
use ;
use 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 = new;
let mut hub = new;
// 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
.request_id
.doit;
match result
Handling Errors
All errors produced by the system are provided either as Result enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the Hub Delegate, or the Authenticator Delegate.
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, should be
read by you to obtain the media.
If such a method also supports a Response Result, 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 to the
Method Builder 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 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 and decodable via json. Optionals are used to indicate that partial requests are responses are valid. Most optionals are are considered Parts 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, 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 are handed by copy
- strings are passed as
&str
- request values are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
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.