Struct google_compute1::api::Compute
source · pub struct Compute<S> {
pub client: Client<S, Body>,
pub auth: Box<dyn GetToken>,
/* private fields */
}
Expand description
Central instance to access all Compute related resource activities
§Examples
Instantiate a new hub
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().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(&Default::default())
.request_id("gubergren")
.add_paths("Lorem")
.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),
}
Fields§
§client: Client<S, Body>
§auth: Box<dyn GetToken>
Implementations§
source§impl<'a, S> Compute<S>
impl<'a, S> Compute<S>
pub fn new<A: 'static + GetToken>( client: Client<S, Body>, auth: A ) -> Compute<S>
pub fn accelerator_types(&'a self) -> AcceleratorTypeMethods<'a, S>
pub fn addresses(&'a self) -> AddressMethods<'a, S>
pub fn autoscalers(&'a self) -> AutoscalerMethods<'a, S>
pub fn backend_buckets(&'a self) -> BackendBucketMethods<'a, S>
pub fn backend_services(&'a self) -> BackendServiceMethods<'a, S>
pub fn disk_types(&'a self) -> DiskTypeMethods<'a, S>
pub fn disks(&'a self) -> DiskMethods<'a, S>
pub fn external_vpn_gateways(&'a self) -> ExternalVpnGatewayMethods<'a, S>
pub fn firewall_policies(&'a self) -> FirewallPolicyMethods<'a, S>
pub fn firewalls(&'a self) -> FirewallMethods<'a, S>
pub fn forwarding_rules(&'a self) -> ForwardingRuleMethods<'a, S>
pub fn global_addresses(&'a self) -> GlobalAddressMethods<'a, S>
pub fn global_forwarding_rules(&'a self) -> GlobalForwardingRuleMethods<'a, S>
pub fn global_network_endpoint_groups( &'a self ) -> GlobalNetworkEndpointGroupMethods<'a, S>
pub fn global_operations(&'a self) -> GlobalOperationMethods<'a, S>
pub fn global_organization_operations( &'a self ) -> GlobalOrganizationOperationMethods<'a, S>
pub fn global_public_delegated_prefixes( &'a self ) -> GlobalPublicDelegatedPrefixMethods<'a, S>
pub fn health_checks(&'a self) -> HealthCheckMethods<'a, S>
pub fn http_health_checks(&'a self) -> HttpHealthCheckMethods<'a, S>
pub fn https_health_checks(&'a self) -> HttpsHealthCheckMethods<'a, S>
pub fn image_family_views(&'a self) -> ImageFamilyViewMethods<'a, S>
pub fn images(&'a self) -> ImageMethods<'a, S>
pub fn instance_group_managers(&'a self) -> InstanceGroupManagerMethods<'a, S>
pub fn instance_groups(&'a self) -> InstanceGroupMethods<'a, S>
pub fn instance_templates(&'a self) -> InstanceTemplateMethods<'a, S>
pub fn instances(&'a self) -> InstanceMethods<'a, S>
pub fn instant_snapshots(&'a self) -> InstantSnapshotMethods<'a, S>
pub fn interconnect_attachments( &'a self ) -> InterconnectAttachmentMethods<'a, S>
pub fn interconnect_locations(&'a self) -> InterconnectLocationMethods<'a, S>
pub fn interconnect_remote_locations( &'a self ) -> InterconnectRemoteLocationMethods<'a, S>
pub fn interconnects(&'a self) -> InterconnectMethods<'a, S>
pub fn license_codes(&'a self) -> LicenseCodeMethods<'a, S>
pub fn licenses(&'a self) -> LicenseMethods<'a, S>
pub fn machine_images(&'a self) -> MachineImageMethods<'a, S>
pub fn machine_types(&'a self) -> MachineTypeMethods<'a, S>
pub fn network_attachments(&'a self) -> NetworkAttachmentMethods<'a, S>
pub fn network_edge_security_services( &'a self ) -> NetworkEdgeSecurityServiceMethods<'a, S>
pub fn network_endpoint_groups(&'a self) -> NetworkEndpointGroupMethods<'a, S>
pub fn network_firewall_policies( &'a self ) -> NetworkFirewallPolicyMethods<'a, S>
pub fn networks(&'a self) -> NetworkMethods<'a, S>
pub fn node_groups(&'a self) -> NodeGroupMethods<'a, S>
pub fn node_templates(&'a self) -> NodeTemplateMethods<'a, S>
pub fn node_types(&'a self) -> NodeTypeMethods<'a, S>
pub fn packet_mirrorings(&'a self) -> PacketMirroringMethods<'a, S>
pub fn projects(&'a self) -> ProjectMethods<'a, S>
pub fn public_advertised_prefixes( &'a self ) -> PublicAdvertisedPrefixMethods<'a, S>
pub fn public_delegated_prefixes( &'a self ) -> PublicDelegatedPrefixMethods<'a, S>
pub fn region_autoscalers(&'a self) -> RegionAutoscalerMethods<'a, S>
pub fn region_backend_services(&'a self) -> RegionBackendServiceMethods<'a, S>
pub fn region_commitments(&'a self) -> RegionCommitmentMethods<'a, S>
pub fn region_disk_types(&'a self) -> RegionDiskTypeMethods<'a, S>
pub fn region_disks(&'a self) -> RegionDiskMethods<'a, S>
pub fn region_health_check_services( &'a self ) -> RegionHealthCheckServiceMethods<'a, S>
pub fn region_health_checks(&'a self) -> RegionHealthCheckMethods<'a, S>
pub fn region_instance_group_managers( &'a self ) -> RegionInstanceGroupManagerMethods<'a, S>
pub fn region_instance_groups(&'a self) -> RegionInstanceGroupMethods<'a, S>
pub fn region_instance_templates( &'a self ) -> RegionInstanceTemplateMethods<'a, S>
pub fn region_instances(&'a self) -> RegionInstanceMethods<'a, S>
pub fn region_instant_snapshots(&'a self) -> RegionInstantSnapshotMethods<'a, S>
pub fn region_network_endpoint_groups( &'a self ) -> RegionNetworkEndpointGroupMethods<'a, S>
pub fn region_network_firewall_policies( &'a self ) -> RegionNetworkFirewallPolicyMethods<'a, S>
pub fn region_notification_endpoints( &'a self ) -> RegionNotificationEndpointMethods<'a, S>
pub fn region_operations(&'a self) -> RegionOperationMethods<'a, S>
pub fn region_security_policies(&'a self) -> RegionSecurityPolicyMethods<'a, S>
pub fn region_ssl_certificates(&'a self) -> RegionSslCertificateMethods<'a, S>
pub fn region_ssl_policies(&'a self) -> RegionSslPolicyMethods<'a, S>
pub fn region_target_http_proxies( &'a self ) -> RegionTargetHttpProxyMethods<'a, S>
pub fn region_target_https_proxies( &'a self ) -> RegionTargetHttpsProxyMethods<'a, S>
pub fn region_target_tcp_proxies(&'a self) -> RegionTargetTcpProxyMethods<'a, S>
pub fn region_url_maps(&'a self) -> RegionUrlMapMethods<'a, S>
pub fn region_zones(&'a self) -> RegionZoneMethods<'a, S>
pub fn regions(&'a self) -> RegionMethods<'a, S>
pub fn reservations(&'a self) -> ReservationMethods<'a, S>
pub fn resource_policies(&'a self) -> ResourcePolicyMethods<'a, S>
pub fn routers(&'a self) -> RouterMethods<'a, S>
pub fn routes(&'a self) -> RouteMethods<'a, S>
pub fn security_policies(&'a self) -> SecurityPolicyMethods<'a, S>
pub fn service_attachments(&'a self) -> ServiceAttachmentMethods<'a, S>
pub fn snapshot_settings(&'a self) -> SnapshotSettingMethods<'a, S>
pub fn snapshots(&'a self) -> SnapshotMethods<'a, S>
pub fn ssl_certificates(&'a self) -> SslCertificateMethods<'a, S>
pub fn ssl_policies(&'a self) -> SslPolicyMethods<'a, S>
pub fn subnetworks(&'a self) -> SubnetworkMethods<'a, S>
pub fn target_grpc_proxies(&'a self) -> TargetGrpcProxyMethods<'a, S>
pub fn target_http_proxies(&'a self) -> TargetHttpProxyMethods<'a, S>
pub fn target_https_proxies(&'a self) -> TargetHttpsProxyMethods<'a, S>
pub fn target_instances(&'a self) -> TargetInstanceMethods<'a, S>
pub fn target_pools(&'a self) -> TargetPoolMethods<'a, S>
pub fn target_ssl_proxies(&'a self) -> TargetSslProxyMethods<'a, S>
pub fn target_tcp_proxies(&'a self) -> TargetTcpProxyMethods<'a, S>
pub fn target_vpn_gateways(&'a self) -> TargetVpnGatewayMethods<'a, S>
pub fn url_maps(&'a self) -> UrlMapMethods<'a, S>
pub fn vpn_gateways(&'a self) -> VpnGatewayMethods<'a, S>
pub fn vpn_tunnels(&'a self) -> VpnTunnelMethods<'a, S>
pub fn zone_operations(&'a self) -> ZoneOperationMethods<'a, S>
pub fn zones(&'a self) -> ZoneMethods<'a, S>
sourcepub fn user_agent(&mut self, agent_name: String) -> String
pub fn user_agent(&mut self, agent_name: String) -> String
Set the user-agent header field to use in all requests to the server.
It defaults to google-api-rust-client/5.0.4
.
Returns the previously set user-agent.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for Compute<S>
impl<S> Send for Compute<S>where
S: Send,
impl<S> Sync for Compute<S>where
S: Sync,
impl<S> Unpin for Compute<S>where
S: Unpin,
impl<S> !UnwindSafe for Compute<S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more