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>

source

pub fn new<A: 'static + GetToken>( client: Client<S, Body>, auth: A ) -> Compute<S>

source

pub fn accelerator_types(&'a self) -> AcceleratorTypeMethods<'a, S>

source

pub fn addresses(&'a self) -> AddressMethods<'a, S>

source

pub fn autoscalers(&'a self) -> AutoscalerMethods<'a, S>

source

pub fn backend_buckets(&'a self) -> BackendBucketMethods<'a, S>

source

pub fn backend_services(&'a self) -> BackendServiceMethods<'a, S>

source

pub fn disk_types(&'a self) -> DiskTypeMethods<'a, S>

source

pub fn disks(&'a self) -> DiskMethods<'a, S>

source

pub fn external_vpn_gateways(&'a self) -> ExternalVpnGatewayMethods<'a, S>

source

pub fn firewall_policies(&'a self) -> FirewallPolicyMethods<'a, S>

source

pub fn firewalls(&'a self) -> FirewallMethods<'a, S>

source

pub fn forwarding_rules(&'a self) -> ForwardingRuleMethods<'a, S>

source

pub fn global_addresses(&'a self) -> GlobalAddressMethods<'a, S>

source

pub fn global_forwarding_rules(&'a self) -> GlobalForwardingRuleMethods<'a, S>

source

pub fn global_network_endpoint_groups( &'a self ) -> GlobalNetworkEndpointGroupMethods<'a, S>

source

pub fn global_operations(&'a self) -> GlobalOperationMethods<'a, S>

source

pub fn global_organization_operations( &'a self ) -> GlobalOrganizationOperationMethods<'a, S>

source

pub fn global_public_delegated_prefixes( &'a self ) -> GlobalPublicDelegatedPrefixMethods<'a, S>

source

pub fn health_checks(&'a self) -> HealthCheckMethods<'a, S>

source

pub fn http_health_checks(&'a self) -> HttpHealthCheckMethods<'a, S>

source

pub fn https_health_checks(&'a self) -> HttpsHealthCheckMethods<'a, S>

source

pub fn image_family_views(&'a self) -> ImageFamilyViewMethods<'a, S>

source

pub fn images(&'a self) -> ImageMethods<'a, S>

source

pub fn instance_group_managers(&'a self) -> InstanceGroupManagerMethods<'a, S>

source

pub fn instance_groups(&'a self) -> InstanceGroupMethods<'a, S>

source

pub fn instance_templates(&'a self) -> InstanceTemplateMethods<'a, S>

source

pub fn instances(&'a self) -> InstanceMethods<'a, S>

source

pub fn instant_snapshots(&'a self) -> InstantSnapshotMethods<'a, S>

source

pub fn interconnect_attachments( &'a self ) -> InterconnectAttachmentMethods<'a, S>

source

pub fn interconnect_locations(&'a self) -> InterconnectLocationMethods<'a, S>

source

pub fn interconnect_remote_locations( &'a self ) -> InterconnectRemoteLocationMethods<'a, S>

source

pub fn interconnects(&'a self) -> InterconnectMethods<'a, S>

source

pub fn license_codes(&'a self) -> LicenseCodeMethods<'a, S>

source

pub fn licenses(&'a self) -> LicenseMethods<'a, S>

source

pub fn machine_images(&'a self) -> MachineImageMethods<'a, S>

source

pub fn machine_types(&'a self) -> MachineTypeMethods<'a, S>

source

pub fn network_attachments(&'a self) -> NetworkAttachmentMethods<'a, S>

source

pub fn network_edge_security_services( &'a self ) -> NetworkEdgeSecurityServiceMethods<'a, S>

source

pub fn network_endpoint_groups(&'a self) -> NetworkEndpointGroupMethods<'a, S>

source

pub fn network_firewall_policies( &'a self ) -> NetworkFirewallPolicyMethods<'a, S>

source

pub fn networks(&'a self) -> NetworkMethods<'a, S>

source

pub fn node_groups(&'a self) -> NodeGroupMethods<'a, S>

source

pub fn node_templates(&'a self) -> NodeTemplateMethods<'a, S>

source

pub fn node_types(&'a self) -> NodeTypeMethods<'a, S>

source

pub fn packet_mirrorings(&'a self) -> PacketMirroringMethods<'a, S>

source

pub fn projects(&'a self) -> ProjectMethods<'a, S>

source

pub fn public_advertised_prefixes( &'a self ) -> PublicAdvertisedPrefixMethods<'a, S>

source

pub fn public_delegated_prefixes( &'a self ) -> PublicDelegatedPrefixMethods<'a, S>

source

pub fn region_autoscalers(&'a self) -> RegionAutoscalerMethods<'a, S>

source

pub fn region_backend_services(&'a self) -> RegionBackendServiceMethods<'a, S>

source

pub fn region_commitments(&'a self) -> RegionCommitmentMethods<'a, S>

source

pub fn region_disk_types(&'a self) -> RegionDiskTypeMethods<'a, S>

source

pub fn region_disks(&'a self) -> RegionDiskMethods<'a, S>

source

pub fn region_health_check_services( &'a self ) -> RegionHealthCheckServiceMethods<'a, S>

source

pub fn region_health_checks(&'a self) -> RegionHealthCheckMethods<'a, S>

source

pub fn region_instance_group_managers( &'a self ) -> RegionInstanceGroupManagerMethods<'a, S>

source

pub fn region_instance_groups(&'a self) -> RegionInstanceGroupMethods<'a, S>

source

pub fn region_instance_templates( &'a self ) -> RegionInstanceTemplateMethods<'a, S>

source

pub fn region_instances(&'a self) -> RegionInstanceMethods<'a, S>

source

pub fn region_instant_snapshots(&'a self) -> RegionInstantSnapshotMethods<'a, S>

source

pub fn region_network_endpoint_groups( &'a self ) -> RegionNetworkEndpointGroupMethods<'a, S>

source

pub fn region_network_firewall_policies( &'a self ) -> RegionNetworkFirewallPolicyMethods<'a, S>

source

pub fn region_notification_endpoints( &'a self ) -> RegionNotificationEndpointMethods<'a, S>

source

pub fn region_operations(&'a self) -> RegionOperationMethods<'a, S>

source

pub fn region_security_policies(&'a self) -> RegionSecurityPolicyMethods<'a, S>

source

pub fn region_ssl_certificates(&'a self) -> RegionSslCertificateMethods<'a, S>

source

pub fn region_ssl_policies(&'a self) -> RegionSslPolicyMethods<'a, S>

source

pub fn region_target_http_proxies( &'a self ) -> RegionTargetHttpProxyMethods<'a, S>

source

pub fn region_target_https_proxies( &'a self ) -> RegionTargetHttpsProxyMethods<'a, S>

source

pub fn region_target_tcp_proxies(&'a self) -> RegionTargetTcpProxyMethods<'a, S>

source

pub fn region_url_maps(&'a self) -> RegionUrlMapMethods<'a, S>

source

pub fn region_zones(&'a self) -> RegionZoneMethods<'a, S>

source

pub fn regions(&'a self) -> RegionMethods<'a, S>

source

pub fn reservations(&'a self) -> ReservationMethods<'a, S>

source

pub fn resource_policies(&'a self) -> ResourcePolicyMethods<'a, S>

source

pub fn routers(&'a self) -> RouterMethods<'a, S>

source

pub fn routes(&'a self) -> RouteMethods<'a, S>

source

pub fn security_policies(&'a self) -> SecurityPolicyMethods<'a, S>

source

pub fn service_attachments(&'a self) -> ServiceAttachmentMethods<'a, S>

source

pub fn snapshot_settings(&'a self) -> SnapshotSettingMethods<'a, S>

source

pub fn snapshots(&'a self) -> SnapshotMethods<'a, S>

source

pub fn ssl_certificates(&'a self) -> SslCertificateMethods<'a, S>

source

pub fn ssl_policies(&'a self) -> SslPolicyMethods<'a, S>

source

pub fn subnetworks(&'a self) -> SubnetworkMethods<'a, S>

source

pub fn target_grpc_proxies(&'a self) -> TargetGrpcProxyMethods<'a, S>

source

pub fn target_http_proxies(&'a self) -> TargetHttpProxyMethods<'a, S>

source

pub fn target_https_proxies(&'a self) -> TargetHttpsProxyMethods<'a, S>

source

pub fn target_instances(&'a self) -> TargetInstanceMethods<'a, S>

source

pub fn target_pools(&'a self) -> TargetPoolMethods<'a, S>

source

pub fn target_ssl_proxies(&'a self) -> TargetSslProxyMethods<'a, S>

source

pub fn target_tcp_proxies(&'a self) -> TargetTcpProxyMethods<'a, S>

source

pub fn target_vpn_gateways(&'a self) -> TargetVpnGatewayMethods<'a, S>

source

pub fn url_maps(&'a self) -> UrlMapMethods<'a, S>

source

pub fn vpn_gateways(&'a self) -> VpnGatewayMethods<'a, S>

source

pub fn vpn_tunnels(&'a self) -> VpnTunnelMethods<'a, S>

source

pub fn zone_operations(&'a self) -> ZoneOperationMethods<'a, S>

source

pub fn zones(&'a self) -> ZoneMethods<'a, S>

source

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.

source

pub fn base_url(&mut self, new_base_url: String) -> String

Set the base url to use in all requests to the server. It defaults to https://compute.googleapis.com/compute/v1/.

Returns the previously set base url.

source

pub fn root_url(&mut self, new_root_url: String) -> String

Set the root url to use in all requests to the server. It defaults to https://compute.googleapis.com/.

Returns the previously set root url.

Trait Implementations§

source§

impl<S: Clone> Clone for Compute<S>

source§

fn clone(&self) -> Compute<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, S> Hub for Compute<S>

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more