pub struct Builder { /* private fields */ }Expand description
A builder for creating credentials that authenticate using an API key.
API keys are convenient because no principal is needed. The API key associates the request with a Google Cloud project for billing and quota purposes.
Note that only some Cloud APIs support API keys. The rest require full credentials.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new<T: Into<String>>(api_key: T) -> Self
pub fn new<T: Into<String>>(api_key: T) -> Self
Creates a new builder with given API key.
§Example
let credentials = Builder::new("my-api-key")
.build();Sourcepub fn with_quota_project_id<T: Into<String>>(self, quota_project_id: T) -> Self
pub fn with_quota_project_id<T: Into<String>>(self, quota_project_id: T) -> Self
Sets the quota project for these credentials.
In some services, you can use an account in one project for authentication
and authorization, and charge the usage to a different project. This requires
that the user has serviceusage.services.use permissions on the quota project.
§Example
let credentials = Builder::new("my-api-key")
.with_quota_project_id("my-project")
.build();Sourcepub fn build(self) -> Credentials
pub fn build(self) -> Credentials
Returns a Credentials instance with the configured settings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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