#compute

google-compute1

与计算(协议 v1)交互的完整库

33 个版本 (17 个稳定版)

5.0.5+20240604 2024 年 6 月 27 日
5.0.4+20240218 2024 年 3 月 5 日
5.0.3+20230103 2023 年 8 月 23 日
5.0.2+20230103 2023 年 3 月 16 日
0.1.2+20150302 2015 年 3 月 25 日

#845数据库接口

Download history 33/week @ 2024-04-15 489/week @ 2024-04-22 445/week @ 2024-04-29 236/week @ 2024-05-06 274/week @ 2024-05-13 254/week @ 2024-05-20 280/week @ 2024-05-27 391/week @ 2024-06-03 471/week @ 2024-06-10 239/week @ 2024-06-17 455/week @ 2024-06-24 124/week @ 2024-07-01 350/week @ 2024-07-08 258/week @ 2024-07-15 94/week @ 2024-07-22 28/week @ 2024-07-29

每月 731 次下载
用于 google-compute1-cli

MIT 许可证

15MB
164K SLoC

《google-compute1》库允许访问 Google 计算服务的所有功能。

此文档是从 compute 软件包版本 5.0.5+20240604 生成的,其中 20240604 是由 mako 代码生成器 v5.0.5 构建的 compute:v1 架构的确切修订版。

有关 compute v1 API 的其他所有信息,请参阅 官方文档网站

特性

从中心 枢纽 轻松处理以下 资源...

该库的结构

API结构如下几个主要项

  • 中心
    • 一个中央对象,用于维护状态并允许访问所有活动
    • 创建方法构建器,这些构建器反过来允许访问单个调用构建器
  • 资源
    • 可以应用活动的基本类型
    • 属性和部分的集合
    • 部分
      • 属性的集合
      • 活动中从不直接使用
  • 活动
    • 应用于资源的操作

所有结构都标记了相应的特质,以进一步分类它们并简化浏览。

一般来说,您可以像这样调用活动

let r = hub.resource().activity(...).doit().await

或者具体...

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

resource()activity(...)调用创建构建器。第二个构建器处理Activities,支持各种方法来配置即将进行的操作(此处未展示)。它被设计成必须立即指定所有必需的参数(即(...)),而所有可选的参数则可以按需构建doit()方法执行与服务器实际通信并返回相应的结果。

用法

设置您的项目

要使用此库,您需要将以下行放入您的Cargo.toml文件

[dependencies]
google-compute1 = "*"
serde = "^1.0"
serde_json = "^1.0"

一个完整的示例

extern crate hyper;
extern crate hyper_rustls;
extern crate google_compute1 as compute1;
use compute1::api::Disk;
use compute1::{Result, Error};
use std::default::Default;
use compute1::{Compute, oauth2, hyper, hyper_rustls, chrono, FieldMask};

// Get an ApplicationSecret instance by some means. It contains the `client_id` and 
// `client_secret`, among other things.
let secret: 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 = oauth2::InstalledFlowAuthenticator::builder(
        secret,
        oauth2::InstalledFlowReturnMethod::HTTPRedirect,
    ).build().await.unwrap();
let mut hub = Compute::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), 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),
}

错误处理

系统产生的所有错误都作为Result()枚举提供,作为doit()方法的返回值,或者作为可能的中继结果传递给Hub Delegate()Authenticator Delegate()

当代理处理错误或中继值时,它们可能会有机会指示系统重试。这使得系统可能对所有类型的错误都具有弹性。

上传和下载

如果方法支持下载,则响应体(它是Result的一部分)应由您读取以获取媒体。如果此类方法还支持Response Result,则默认返回该值。您可以将其视为实际媒体的元数据。要触发媒体下载,您必须通过此调用设置构建器:.param("alt", "media")

支持上传的方法可以使用最多2种不同的协议:简单可恢复。每种协议的区分性由自定义的doit(...)方法表示,分别命名为upload(...)upload_resumable(...)

自定义和回调

您可以通过提供一个委托方法构建器,在调用最终的doit()之前,来改变一个doit()方法的调用方式。相应的会调用方法来提供进度信息,并确定系统在失败时是否应该重试。

委托特质默认实现,允许您以最小的努力进行自定义。

服务器请求中的可选部分

此库提供的所有结构都是为了通过json进行编码解码而设计的。可选部分用于表示部分请求和响应是有效的。大多数可选部分被视为部分,可以通过名称识别,这些部分将被发送到服务器,以指示请求的设置部分或响应中所需的部分。

构建器参数

使用方法构建器,您可以通过反复调用其方法来准备一个动作调用。这些方法始终接受单个参数,以下陈述对它适用。

  • POD通过复制传递
  • 字符串作为&str传递
  • 请求值是移动的

参数始终会被复制或克隆到构建器中,以便它们独立于其原始的生命周期。

Cargo功能

  • utoipa - 添加对utoipa的支持,并从所有类型中推导出utoipa::ToSchema。您必须在#[openapi(schemas(...))]中导入和注册所需的类型,否则生成的openapi规范将是无效的。

许可证

compute1库是由Sebastian Thiel生成的,并置于MIT许可证下。您可以在存储库的许可证文件中阅读全文。

依赖项

~12–23MB
~344K SLoC