Skip to main content

Crate gcloud_sdk

Crate gcloud_sdk 

Source
Expand description

§Google Cloud SDK for Rust

Library provides all available APIs generated based:

  • on proto interfaces for gRPC;
  • OpenAPI spec for REST APIs not available as gRPC;

The library also provides and easy-to-use client API for both gRPC and REST, that supports Google Authentication natively.

§gRPC example

ⓘ

    let firestore_client: GoogleApi<FirestoreClient<GoogleAuthMiddleware>> =
       GoogleApi::from_function(
           FirestoreClient::new,
           "https://firestore.googleapis.com",
           // cloud resource prefix: used only for some of the APIs (such as Firestore)
           Some(cloud_resource_prefix.clone()),
       )
       .await?;

    let response = firestore_client
        .get()
        .list_documents(tonic::Request::new(ListDocumentsRequest {
            parent: format!("{}/documents", cloud_resource_prefix),
            ..Default::default()
        }))
        .await?;

§REST example

ⓘ

let google_rest_client = gcloud_sdk::GoogleRestApi::new().await?;

let response = gcloud_sdk::google_rest_apis::storage::buckets_api::storage_buckets_list(
    &google_rest_client.create_google_storage_config().await?,
    gcloud_sdk::google_rest_apis::storage::buckets_api::StoragePeriodBucketsPeriodListParams {
        project: google_project_id,
        ..Default::default()
    }
).await?;

Complete examples available on github.

Re-exports§

pub use prost;
pub use prost_types;
pub use tonic;

Modules§

cloud
error
google
google_rest_apis
grafeas
id_token_verify
Verification of Google-signed ID tokens, for the receiving side of a service-to-service call.
maps
proto_ext

Structs§

ExternalJwtFunctionSource
GceMetadataClient
GoogleApiClient
GoogleApiClientBuilderFunction
GoogleAuthMiddlewareLayer
GoogleAuthReqwestMiddleware
A reqwest-middleware middleware that sets the authorization header of every request to the current token of a GoogleAuthTokenGenerator: an ID token for a generator over an IdTokenSource, or an access token for one over Google credentials.
GoogleAuthTokenGenerator
GoogleEnvironment
GoogleRestApi
HeaderMap
A specialized multimap for header names and values.
IdTokenAudience
The audience an ID token is minted for and checked against: the URL of a Cloud Run service or a Cloud Run function, a custom audience configured on the service, or the OAuth client ID of a resource behind Identity-Aware Proxy.
IdTokenSource
Mints Google-signed ID tokens for one audience, for calling services that check them, such as Cloud Run, Cloud Run functions and Identity-Aware Proxy.
SecretValue
ServiceAccountEmail
The email of a service account, such as invoker@my-project.iam.gserviceaccount.com.
Token
VerifyIdToken
The service made by VerifyIdTokenLayer.
VerifyIdTokenLayer
A tower layer that lets a request through only with a valid Google ID token in its authorization: Bearer header, and puts the token’s claims into the request’s extensions for the VerifiedIdToken extractor.

Enums§

TokenSourceType

Constants§

CERTIFICATES
GCLOUD_SDK_USER_AGENT

Statics§

GCP_DEFAULT_SCOPES

Traits§

GoogleApiClientBuilder
Source

Functions§

create_hyper_uri_with_params

Type Aliases§

BoxSource
GoogleApi
GoogleAuthMiddleware