pub struct Credentials {
pub access_key_id: String,
pub secret_access_key: String,
}Expand description
Represents the authentication credentials required to access Volcengine services.
This struct holds the necessary credentials used for authenticating API requests
to Volcengine. These credentials are typically provided by the service and must
be securely managed to prevent unauthorized access.
§Fields
access_key_id(String): The access key ID associated with the user or application. This key acts as a unique identifier for authentication.secret_access_key(String): The secret access key associated with the access key ID. This key must be kept secure, as it is used to sign API requests.
§Security Considerations
- The
secret_access_keyshould never be exposed in logs, environment variables,
or source code repositories. - Always use secure storage mechanisms, such as environment variables, secrets management
tools, or encrypted configuration files, to store credentials. - Rotate credentials periodically to minimize security risks.
§Example Usage
let creds = Credentials {
access_key_id: "your-access-key-id".to_string(),
secret_access_key: "your-secret-access-key".to_string(),
};
println!("Access Key ID: {}", creds.access_key_id);This struct is often used in conjunction with authentication mechanisms when making
API requests to Volcengine services.
Fields§
§access_key_id: StringThe access key ID for authentication.
secret_access_key: StringThe secret access key for authentication (must be kept secure).
Implementations§
Source§impl Credentials
Represents a set of credentials used for authenticating API requests.
impl Credentials
Represents a set of credentials used for authenticating API requests.
This struct holds the access key ID and secret access key required for signing requests and authenticating with the API service. These credentials are used to prove the identity of the user or application making the requests and to ensure that the requests are authorized.
The Credentials struct provides a simple, efficient way to manage the credentials
needed for accessing protected resources in the Volcengine API, and it is typically
used in API client configurations where authentication is necessary.
§Example
let creds = Credentials::new("your-access-key-id", "your-secret-access-key");
println!("Access Key ID: {}", creds.access_key_id);
println!("Secret Access Key: {}", creds.secret_access_key);This example demonstrates how to create a new instance of the Credentials struct
using the new method, providing the required access key ID and secret access key.
Sourcepub fn new(access_key_id: &str, secret_access_key: &str) -> Self
pub fn new(access_key_id: &str, secret_access_key: &str) -> Self
Creates a new instance of the Credentials struct.
This constructor method takes in the access key ID and the secret access key
as string slices (&str) and returns a new Credentials instance with these values.
§Parameters
access_key_id(&str): The access key ID associated with the user or application.
This is used for identifying the user or system when making API requests.secret_access_key(&str): The secret access key that corresponds to the access key ID.
This is used for signing the requests to ensure the authenticity of the caller.
§Returns
Returns a new Credentials instance (Self) containing the provided access key ID and
secret access key as String values.
§Example
let creds = Credentials::new("your-access-key-id", "your-secret-access-key");
println!("Access Key ID: {}", creds.access_key_id);
println!("Secret Access Key: {}", creds.secret_access_key);Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request