#compute

google-compute1

A complete library to interact with compute (protocol v1)

34 releases (18 stable)

6.0.0+20240604 Oct 15, 2024
5.0.5+20240604 Jun 27, 2024
5.0.4+20240218 Mar 5, 2024
5.0.3+20230103 Aug 23, 2023
0.1.2+20150302 Mar 25, 2015

#345 in Database interfaces

Download history 94/week @ 2024-07-22 28/week @ 2024-07-29 16/week @ 2024-08-05 30/week @ 2024-08-12 47/week @ 2024-08-19 7/week @ 2024-08-26 33/week @ 2024-09-02 6/week @ 2024-09-09 19/week @ 2024-09-16 108/week @ 2024-09-23 41/week @ 2024-09-30 70/week @ 2024-10-07 163/week @ 2024-10-14 29/week @ 2024-10-21 48/week @ 2024-10-28 47/week @ 2024-11-04

297 downloads per month
Used in google-compute1-cli

MIT license

15MB
194K SLoC

The google-compute1 library allows access to all features of the Google compute service.

This documentation was generated from compute crate version 6.0.0+20240604, where 20240604 is the exact revision of the compute:v1 schema built by the mako code generator v6.0.0.

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

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

Or specifically ...

let r = hub.addresses().delete(...).doit().await
let r = hub.addresses().insert(...).doit().await
let r = hub.addresses().move_(...).doit().await
let r = hub.addresses().set_labels(...).doit().await
let r = hub.autoscalers().delete(...).doit().await
let r = hub.autoscalers().insert(...).doit().await
let r = hub.autoscalers().patch(...).doit().await
let r = hub.autoscalers().update(...).doit().await
let r = hub.backend_buckets().add_signed_url_key(...).doit().await
let r = hub.backend_buckets().delete(...).doit().await
let r = hub.backend_buckets().delete_signed_url_key(...).doit().await
let r = hub.backend_buckets().insert(...).doit().await
let r = hub.backend_buckets().patch(...).doit().await
let r = hub.backend_buckets().set_edge_security_policy(...).doit().await
let r = hub.backend_buckets().update(...).doit().await
let r = hub.backend_services().add_signed_url_key(...).doit().await
let r = hub.backend_services().delete(...).doit().await
let r = hub.backend_services().delete_signed_url_key(...).doit().await
let r = hub.backend_services().insert(...).doit().await
let r = hub.backend_services().patch(...).doit().await
let r = hub.backend_services().set_edge_security_policy(...).doit().await
let r = hub.backend_services().set_security_policy(...).doit().await
let r = hub.backend_services().update(...).doit().await
let r = hub.disks().add_resource_policies(...).doit().await
let r = hub.disks().bulk_insert(...).doit().await
let r = hub.disks().create_snapshot(...).doit().await
let r = hub.disks().delete(...).doit().await
let r = hub.disks().insert(...).doit().await
let r = hub.disks().remove_resource_policies(...).doit().await
let r = hub.disks().resize(...).doit().await
let r = hub.disks().set_labels(...).doit().await
let r = hub.disks().start_async_replication(...).doit().await
let r = hub.disks().stop_async_replication(...).doit().await
let r = hub.disks().stop_group_async_replication(...).doit().await
let r = hub.disks().update(...).doit().await
let r = hub.external_vpn_gateways().delete(...).doit().await
let r = hub.external_vpn_gateways().insert(...).doit().await
let r = hub.external_vpn_gateways().set_labels(...).doit().await
let r = hub.firewall_policies().add_association(...).doit().await
let r = hub.firewall_policies().add_rule(...).doit().await
let r = hub.firewall_policies().clone_rules(...).doit().await
let r = hub.firewall_policies().delete(...).doit().await
let r = hub.firewall_policies().insert(...).doit().await
let r = hub.firewall_policies().move_(...).doit().await
let r = hub.firewall_policies().patch(...).doit().await
let r = hub.firewall_policies().patch_rule(...).doit().await
let r = hub.firewall_policies().remove_association(...).doit().await
let r = hub.firewall_policies().remove_rule(...).doit().await
let r = hub.firewalls().delete(...).doit().await
let r = hub.firewalls().insert(...).doit().await
let r = hub.firewalls().patch(...).doit().await
let r = hub.firewalls().update(...).doit().await
let r = hub.forwarding_rules().delete(...).doit().await
let r = hub.forwarding_rules().insert(...).doit().await
let r = hub.forwarding_rules().patch(...).doit().await
let r = hub.forwarding_rules().set_labels(...).doit().await
let r = hub.forwarding_rules().set_target(...).doit().await
let r = hub.global_addresses().delete(...).doit().await
let r = hub.global_addresses().insert(...).doit().await
let r = hub.global_addresses().move_(...).doit().await
let r = hub.global_addresses().set_labels(...).doit().await
let r = hub.global_forwarding_rules().delete(...).doit().await
let r = hub.global_forwarding_rules().insert(...).doit().await
let r = hub.global_forwarding_rules().patch(...).doit().await
let r = hub.global_forwarding_rules().set_labels(...).doit().await
let r = hub.global_forwarding_rules().set_target(...).doit().await
let r = hub.global_network_endpoint_groups().attach_network_endpoints(...).doit().await
let r = hub.global_network_endpoint_groups().delete(...).doit().await
let r = hub.global_network_endpoint_groups().detach_network_endpoints(...).doit().await
let r = hub.global_network_endpoint_groups().insert(...).doit().await
let r = hub.global_operations().get(...).doit().await
let r = hub.global_operations().wait(...).doit().await
let r = hub.global_organization_operations().get(...).doit().await
let r = hub.global_public_delegated_prefixes().delete(...).doit().await
let r = hub.global_public_delegated_prefixes().insert(...).doit().await
let r = hub.global_public_delegated_prefixes().patch(...).doit().await
let r = hub.health_checks().delete(...).doit().await
let r = hub.health_checks().insert(...).doit().await
let r = hub.health_checks().patch(...).doit().await
let r = hub.health_checks().update(...).doit().await
let r = hub.http_health_checks().delete(...).doit().await
let r = hub.http_health_checks().insert(...).doit().await
let r = hub.http_health_checks().patch(...).doit().await
let r = hub.http_health_checks().update(...).doit().await
let r = hub.https_health_checks().delete(...).doit().await
let r = hub.https_health_checks().insert(...).doit().await
let r = hub.https_health_checks().patch(...).doit().await
let r = hub.https_health_checks().update(...).doit().await
let r = hub.images().delete(...).doit().await
let r = hub.images().deprecate(...).doit().await
let r = hub.images().insert(...).doit().await
let r = hub.images().patch(...).doit().await
let r = hub.images().set_labels(...).doit().await
let r = hub.instance_group_manager_resize_requests().cancel(...).doit().await
let r = hub.instance_group_manager_resize_requests().delete(...).doit().await
let r = hub.instance_group_manager_resize_requests().insert(...).doit().await
let r = hub.instance_group_managers().abandon_instances(...).doit().await
let r = hub.instance_group_managers().apply_updates_to_instances(...).doit().await
let r = hub.instance_group_managers().create_instances(...).doit().await
let r = hub.instance_group_managers().delete(...).doit().await
let r = hub.instance_group_managers().delete_instances(...).doit().await
let r = hub.instance_group_managers().delete_per_instance_configs(...).doit().await
let r = hub.instance_group_managers().insert(...).doit().await
let r = hub.instance_group_managers().patch(...).doit().await
let r = hub.instance_group_managers().patch_per_instance_configs(...).doit().await
let r = hub.instance_group_managers().recreate_instances(...).doit().await
let r = hub.instance_group_managers().resize(...).doit().await
let r = hub.instance_group_managers().set_instance_template(...).doit().await
let r = hub.instance_group_managers().set_target_pools(...).doit().await
let r = hub.instance_group_managers().update_per_instance_configs(...).doit().await
let r = hub.instance_groups().add_instances(...).doit().await
let r = hub.instance_groups().delete(...).doit().await
let r = hub.instance_groups().insert(...).doit().await
let r = hub.instance_groups().remove_instances(...).doit().await
let r = hub.instance_groups().set_named_ports(...).doit().await
let r = hub.instance_settings().patch(...).doit().await
let r = hub.instance_templates().delete(...).doit().await
let r = hub.instance_templates().insert(...).doit().await
let r = hub.instances().add_access_config(...).doit().await
let r = hub.instances().add_resource_policies(...).doit().await
let r = hub.instances().attach_disk(...).doit().await
let r = hub.instances().bulk_insert(...).doit().await
let r = hub.instances().delete(...).doit().await
let r = hub.instances().delete_access_config(...).doit().await
let r = hub.instances().detach_disk(...).doit().await
let r = hub.instances().insert(...).doit().await
let r = hub.instances().perform_maintenance(...).doit().await
let r = hub.instances().remove_resource_policies(...).doit().await
let r = hub.instances().reset(...).doit().await
let r = hub.instances().resume(...).doit().await
let r = hub.instances().set_deletion_protection(...).doit().await
let r = hub.instances().set_disk_auto_delete(...).doit().await
let r = hub.instances().set_labels(...).doit().await
let r = hub.instances().set_machine_resources(...).doit().await
let r = hub.instances().set_machine_type(...).doit().await
let r = hub.instances().set_metadata(...).doit().await
let r = hub.instances().set_min_cpu_platform(...).doit().await
let r = hub.instances().set_name(...).doit().await
let r = hub.instances().set_scheduling(...).doit().await
let r = hub.instances().set_security_policy(...).doit().await
let r = hub.instances().set_service_account(...).doit().await
let r = hub.instances().set_shielded_instance_integrity_policy(...).doit().await
let r = hub.instances().set_tags(...).doit().await
let r = hub.instances().simulate_maintenance_event(...).doit().await
let r = hub.instances().start(...).doit().await
let r = hub.instances().start_with_encryption_key(...).doit().await
let r = hub.instances().stop(...).doit().await
let r = hub.instances().suspend(...).doit().await
let r = hub.instances().update(...).doit().await
let r = hub.instances().update_access_config(...).doit().await
let r = hub.instances().update_display_device(...).doit().await
let r = hub.instances().update_network_interface(...).doit().await
let r = hub.instances().update_shielded_instance_config(...).doit().await
let r = hub.instant_snapshots().delete(...).doit().await
let r = hub.instant_snapshots().insert(...).doit().await
let r = hub.instant_snapshots().set_labels(...).doit().await
let r = hub.interconnect_attachments().delete(...).doit().await
let r = hub.interconnect_attachments().insert(...).doit().await
let r = hub.interconnect_attachments().patch(...).doit().await
let r = hub.interconnect_attachments().set_labels(...).doit().await
let r = hub.interconnects().delete(...).doit().await
let r = hub.interconnects().insert(...).doit().await
let r = hub.interconnects().patch(...).doit().await
let r = hub.interconnects().set_labels(...).doit().await
let r = hub.licenses().delete(...).doit().await
let r = hub.licenses().insert(...).doit().await
let r = hub.machine_images().delete(...).doit().await
let r = hub.machine_images().insert(...).doit().await
let r = hub.network_attachments().delete(...).doit().await
let r = hub.network_attachments().insert(...).doit().await
let r = hub.network_attachments().patch(...).doit().await
let r = hub.network_edge_security_services().delete(...).doit().await
let r = hub.network_edge_security_services().insert(...).doit().await
let r = hub.network_edge_security_services().patch(...).doit().await
let r = hub.network_endpoint_groups().attach_network_endpoints(...).doit().await
let r = hub.network_endpoint_groups().delete(...).doit().await
let r = hub.network_endpoint_groups().detach_network_endpoints(...).doit().await
let r = hub.network_endpoint_groups().insert(...).doit().await
let r = hub.network_firewall_policies().add_association(...).doit().await
let r = hub.network_firewall_policies().add_rule(...).doit().await
let r = hub.network_firewall_policies().clone_rules(...).doit().await
let r = hub.network_firewall_policies().delete(...).doit().await
let r = hub.network_firewall_policies().insert(...).doit().await
let r = hub.network_firewall_policies().patch(...).doit().await
let r = hub.network_firewall_policies().patch_rule(...).doit().await
let r = hub.network_firewall_policies().remove_association(...).doit().await
let r = hub.network_firewall_policies().remove_rule(...).doit().await
let r = hub.networks().add_peering(...).doit().await
let r = hub.networks().delete(...).doit().await
let r = hub.networks().insert(...).doit().await
let r = hub.networks().patch(...).doit().await
let r = hub.networks().remove_peering(...).doit().await
let r = hub.networks().switch_to_custom_mode(...).doit().await
let r = hub.networks().update_peering(...).doit().await
let r = hub.node_groups().add_nodes(...).doit().await
let r = hub.node_groups().delete(...).doit().await
let r = hub.node_groups().delete_nodes(...).doit().await
let r = hub.node_groups().insert(...).doit().await
let r = hub.node_groups().patch(...).doit().await
let r = hub.node_groups().perform_maintenance(...).doit().await
let r = hub.node_groups().set_node_template(...).doit().await
let r = hub.node_groups().simulate_maintenance_event(...).doit().await
let r = hub.node_templates().delete(...).doit().await
let r = hub.node_templates().insert(...).doit().await
let r = hub.packet_mirrorings().delete(...).doit().await
let r = hub.packet_mirrorings().insert(...).doit().await
let r = hub.packet_mirrorings().patch(...).doit().await
let r = hub.projects().disable_xpn_host(...).doit().await
let r = hub.projects().disable_xpn_resource(...).doit().await
let r = hub.projects().enable_xpn_host(...).doit().await
let r = hub.projects().enable_xpn_resource(...).doit().await
let r = hub.projects().move_disk(...).doit().await
let r = hub.projects().move_instance(...).doit().await
let r = hub.projects().set_cloud_armor_tier(...).doit().await
let r = hub.projects().set_common_instance_metadata(...).doit().await
let r = hub.projects().set_default_network_tier(...).doit().await
let r = hub.projects().set_usage_export_bucket(...).doit().await
let r = hub.public_advertised_prefixes().announce(...).doit().await
let r = hub.public_advertised_prefixes().delete(...).doit().await
let r = hub.public_advertised_prefixes().insert(...).doit().await
let r = hub.public_advertised_prefixes().patch(...).doit().await
let r = hub.public_advertised_prefixes().withdraw(...).doit().await
let r = hub.public_delegated_prefixes().announce(...).doit().await
let r = hub.public_delegated_prefixes().delete(...).doit().await
let r = hub.public_delegated_prefixes().insert(...).doit().await
let r = hub.public_delegated_prefixes().patch(...).doit().await
let r = hub.public_delegated_prefixes().withdraw(...).doit().await
let r = hub.region_autoscalers().delete(...).doit().await
let r = hub.region_autoscalers().insert(...).doit().await
let r = hub.region_autoscalers().patch(...).doit().await
let r = hub.region_autoscalers().update(...).doit().await
let r = hub.region_backend_services().delete(...).doit().await
let r = hub.region_backend_services().insert(...).doit().await
let r = hub.region_backend_services().patch(...).doit().await
let r = hub.region_backend_services().set_security_policy(...).doit().await
let r = hub.region_backend_services().update(...).doit().await
let r = hub.region_commitments().insert(...).doit().await
let r = hub.region_commitments().update(...).doit().await
let r = hub.region_disks().add_resource_policies(...).doit().await
let r = hub.region_disks().bulk_insert(...).doit().await
let r = hub.region_disks().create_snapshot(...).doit().await
let r = hub.region_disks().delete(...).doit().await
let r = hub.region_disks().insert(...).doit().await
let r = hub.region_disks().remove_resource_policies(...).doit().await
let r = hub.region_disks().resize(...).doit().await
let r = hub.region_disks().set_labels(...).doit().await
let r = hub.region_disks().start_async_replication(...).doit().await
let r = hub.region_disks().stop_async_replication(...).doit().await
let r = hub.region_disks().stop_group_async_replication(...).doit().await
let r = hub.region_disks().update(...).doit().await
let r = hub.region_health_check_services().delete(...).doit().await
let r = hub.region_health_check_services().insert(...).doit().await
let r = hub.region_health_check_services().patch(...).doit().await
let r = hub.region_health_checks().delete(...).doit().await
let r = hub.region_health_checks().insert(...).doit().await
let r = hub.region_health_checks().patch(...).doit().await
let r = hub.region_health_checks().update(...).doit().await
let r = hub.region_instance_group_managers().abandon_instances(...).doit().await
let r = hub.region_instance_group_managers().apply_updates_to_instances(...).doit().await
let r = hub.region_instance_group_managers().create_instances(...).doit().await
let r = hub.region_instance_group_managers().delete(...).doit().await
let r = hub.region_instance_group_managers().delete_instances(...).doit().await
let r = hub.region_instance_group_managers().delete_per_instance_configs(...).doit().await
let r = hub.region_instance_group_managers().insert(...).doit().await
let r = hub.region_instance_group_managers().patch(...).doit().await
let r = hub.region_instance_group_managers().patch_per_instance_configs(...).doit().await
let r = hub.region_instance_group_managers().recreate_instances(...).doit().await
let r = hub.region_instance_group_managers().resize(...).doit().await
let r = hub.region_instance_group_managers().set_instance_template(...).doit().await
let r = hub.region_instance_group_managers().set_target_pools(...).doit().await
let r = hub.region_instance_group_managers().update_per_instance_configs(...).doit().await
let r = hub.region_instance_groups().set_named_ports(...).doit().await
let r = hub.region_instance_templates().delete(...).doit().await
let r = hub.region_instance_templates().insert(...).doit().await
let r = hub.region_instances().bulk_insert(...).doit().await
let r = hub.region_instant_snapshots().delete(...).doit().await
let r = hub.region_instant_snapshots().insert(...).doit().await
let r = hub.region_instant_snapshots().set_labels(...).doit().await
let r = hub.region_network_endpoint_groups().attach_network_endpoints(...).doit().await
let r = hub.region_network_endpoint_groups().delete(...).doit().await
let r = hub.region_network_endpoint_groups().detach_network_endpoints(...).doit().await
let r = hub.region_network_endpoint_groups().insert(...).doit().await
let r = hub.region_network_firewall_policies().add_association(...).doit().await
let r = hub.region_network_firewall_policies().add_rule(...).doit().await
let r = hub.region_network_firewall_policies().clone_rules(...).doit().await
let r = hub.region_network_firewall_policies().delete(...).doit().await
let r = hub.region_network_firewall_policies().insert(...).doit().await
let r = hub.region_network_firewall_policies().patch(...).doit().await
let r = hub.region_network_firewall_policies().patch_rule(...).doit().await
let r = hub.region_network_firewall_policies().remove_association(...).doit().await
let r = hub.region_network_firewall_policies().remove_rule(...).doit().await
let r = hub.region_notification_endpoints().delete(...).doit().await
let r = hub.region_notification_endpoints().insert(...).doit().await
let r = hub.region_operations().get(...).doit().await
let r = hub.region_operations().wait(...).doit().await
let r = hub.region_security_policies().add_rule(...).doit().await
let r = hub.region_security_policies().delete(...).doit().await
let r = hub.region_security_policies().insert(...).doit().await
let r = hub.region_security_policies().patch(...).doit().await
let r = hub.region_security_policies().patch_rule(...).doit().await
let r = hub.region_security_policies().remove_rule(...).doit().await
let r = hub.region_ssl_certificates().delete(...).doit().await
let r = hub.region_ssl_certificates().insert(...).doit().await
let r = hub.region_ssl_policies().delete(...).doit().await
let r = hub.region_ssl_policies().insert(...).doit().await
let r = hub.region_ssl_policies().patch(...).doit().await
let r = hub.region_target_http_proxies().delete(...).doit().await
let r = hub.region_target_http_proxies().insert(...).doit().await
let r = hub.region_target_http_proxies().set_url_map(...).doit().await
let r = hub.region_target_https_proxies().delete(...).doit().await
let r = hub.region_target_https_proxies().insert(...).doit().await
let r = hub.region_target_https_proxies().patch(...).doit().await
let r = hub.region_target_https_proxies().set_ssl_certificates(...).doit().await
let r = hub.region_target_https_proxies().set_url_map(...).doit().await
let r = hub.region_target_tcp_proxies().delete(...).doit().await
let r = hub.region_target_tcp_proxies().insert(...).doit().await
let r = hub.region_url_maps().delete(...).doit().await
let r = hub.region_url_maps().insert(...).doit().await
let r = hub.region_url_maps().patch(...).doit().await
let r = hub.region_url_maps().update(...).doit().await
let r = hub.reservations().delete(...).doit().await
let r = hub.reservations().insert(...).doit().await
let r = hub.reservations().resize(...).doit().await
let r = hub.reservations().update(...).doit().await
let r = hub.resource_policies().delete(...).doit().await
let r = hub.resource_policies().insert(...).doit().await
let r = hub.resource_policies().patch(...).doit().await
let r = hub.routers().delete(...).doit().await
let r = hub.routers().insert(...).doit().await
let r = hub.routers().patch(...).doit().await
let r = hub.routers().update(...).doit().await
let r = hub.routes().delete(...).doit().await
let r = hub.routes().insert(...).doit().await
let r = hub.security_policies().add_rule(...).doit().await
let r = hub.security_policies().delete(...).doit().await
let r = hub.security_policies().insert(...).doit().await
let r = hub.security_policies().patch(...).doit().await
let r = hub.security_policies().patch_rule(...).doit().await
let r = hub.security_policies().remove_rule(...).doit().await
let r = hub.security_policies().set_labels(...).doit().await
let r = hub.service_attachments().delete(...).doit().await
let r = hub.service_attachments().insert(...).doit().await
let r = hub.service_attachments().patch(...).doit().await
let r = hub.snapshot_settings().patch(...).doit().await
let r = hub.snapshots().delete(...).doit().await
let r = hub.snapshots().insert(...).doit().await
let r = hub.snapshots().set_labels(...).doit().await
let r = hub.ssl_certificates().delete(...).doit().await
let r = hub.ssl_certificates().insert(...).doit().await
let r = hub.ssl_policies().delete(...).doit().await
let r = hub.ssl_policies().insert(...).doit().await
let r = hub.ssl_policies().patch(...).doit().await
let r = hub.storage_pools().delete(...).doit().await
let r = hub.storage_pools().insert(...).doit().await
let r = hub.storage_pools().update(...).doit().await
let r = hub.subnetworks().delete(...).doit().await
let r = hub.subnetworks().expand_ip_cidr_range(...).doit().await
let r = hub.subnetworks().insert(...).doit().await
let r = hub.subnetworks().patch(...).doit().await
let r = hub.subnetworks().set_private_ip_google_access(...).doit().await
let r = hub.target_grpc_proxies().delete(...).doit().await
let r = hub.target_grpc_proxies().insert(...).doit().await
let r = hub.target_grpc_proxies().patch(...).doit().await
let r = hub.target_http_proxies().delete(...).doit().await
let r = hub.target_http_proxies().insert(...).doit().await
let r = hub.target_http_proxies().patch(...).doit().await
let r = hub.target_http_proxies().set_url_map(...).doit().await
let r = hub.target_https_proxies().delete(...).doit().await
let r = hub.target_https_proxies().insert(...).doit().await
let r = hub.target_https_proxies().patch(...).doit().await
let r = hub.target_https_proxies().set_certificate_map(...).doit().await
let r = hub.target_https_proxies().set_quic_override(...).doit().await
let r = hub.target_https_proxies().set_ssl_certificates(...).doit().await
let r = hub.target_https_proxies().set_ssl_policy(...).doit().await
let r = hub.target_https_proxies().set_url_map(...).doit().await
let r = hub.target_instances().delete(...).doit().await
let r = hub.target_instances().insert(...).doit().await
let r = hub.target_instances().set_security_policy(...).doit().await
let r = hub.target_pools().add_health_check(...).doit().await
let r = hub.target_pools().add_instance(...).doit().await
let r = hub.target_pools().delete(...).doit().await
let r = hub.target_pools().insert(...).doit().await
let r = hub.target_pools().remove_health_check(...).doit().await
let r = hub.target_pools().remove_instance(...).doit().await
let r = hub.target_pools().set_backup(...).doit().await
let r = hub.target_pools().set_security_policy(...).doit().await
let r = hub.target_ssl_proxies().delete(...).doit().await
let r = hub.target_ssl_proxies().insert(...).doit().await
let r = hub.target_ssl_proxies().set_backend_service(...).doit().await
let r = hub.target_ssl_proxies().set_certificate_map(...).doit().await
let r = hub.target_ssl_proxies().set_proxy_header(...).doit().await
let r = hub.target_ssl_proxies().set_ssl_certificates(...).doit().await
let r = hub.target_ssl_proxies().set_ssl_policy(...).doit().await
let r = hub.target_tcp_proxies().delete(...).doit().await
let r = hub.target_tcp_proxies().insert(...).doit().await
let r = hub.target_tcp_proxies().set_backend_service(...).doit().await
let r = hub.target_tcp_proxies().set_proxy_header(...).doit().await
let r = hub.target_vpn_gateways().delete(...).doit().await
let r = hub.target_vpn_gateways().insert(...).doit().await
let r = hub.target_vpn_gateways().set_labels(...).doit().await
let r = hub.url_maps().delete(...).doit().await
let r = hub.url_maps().insert(...).doit().await
let r = hub.url_maps().invalidate_cache(...).doit().await
let r = hub.url_maps().patch(...).doit().await
let r = hub.url_maps().update(...).doit().await
let r = hub.vpn_gateways().delete(...).doit().await
let r = hub.vpn_gateways().insert(...).doit().await
let r = hub.vpn_gateways().set_labels(...).doit().await
let r = hub.vpn_tunnels().delete(...).doit().await
let r = hub.vpn_tunnels().insert(...).doit().await
let r = hub.vpn_tunnels().set_labels(...).doit().await
let r = hub.zone_operations().get(...).doit().await
let r = hub.zone_operations().wait(...).doit().await

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:

[dependencies]
google-compute1 = "*"
serde = "1"
serde_json = "1"

A complete example

extern crate hyper;
extern crate hyper_rustls;
extern crate google_compute1 as compute1;
use compute1::api::Disk;
use compute1::{Result, Error};
use compute1::{Compute, FieldMask, hyper_rustls, hyper_util, yup_oauth2};

// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: yup_oauth2::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 = yup_oauth2::InstalledFlowAuthenticator::builder(
    secret,
    yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();

let client = hyper_util::client::legacy::Client::builder(
    hyper_util::rt::TokioExecutor::new()
)
.build(
    hyper_rustls::HttpsConnectorBuilder::new()
        .with_native_roots()
        .unwrap()
        .https_or_http()
        .enable_http1()
        .build()
);
let mut hub = Compute::new(client, auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = Disk::default();

// 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.disks().update(req, "project", "zone", "disk")
             .update_mask(FieldMask::new::<&str>(&[]))
             .request_id("ipsum")
             .add_paths("voluptua.")
             .doit().await;

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::Io(_)
        |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 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 encodable 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.

Arguments will always be copied or cloned into the builder, to make them independent of their original life times.

Cargo Features

  • utoipa - Add support for utoipa and derive utoipa::ToSchema on all the types. You'll have to import and register the required types in #[openapi(schemas(...))], otherwise the generated openapi spec would be invalid.

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.

Dependencies

~20–31MB
~565K SLoC