Package com.azure.core.credential
Class KeyCredential
java.lang.Object
com.azure.core.credential.KeyCredential
- Direct Known Subclasses:
AzureKeyCredential
Represents a credential that uses a key to authenticate.
-
Constructor Summary
ConstructorsConstructorDescriptionKeyCredential(String key) Creates a credential that authorizes request with the given key. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()Retrieves the key associated to this credential.Rotates the key associated to this credential.
-
Constructor Details
-
KeyCredential
Creates a credential that authorizes request with the given key.- Parameters:
key- The key used to authorize requests.- Throws:
NullPointerException- Ifkeyisnull.IllegalArgumentException- Ifkeyis an empty string.
-
-
Method Details
-
getKey
Retrieves the key associated to this credential.- Returns:
- The key being used to authorize requests.
-
update
Rotates the key associated to this credential.- Parameters:
key- The new key to associated with this credential.- Returns:
- The updated
KeyCredentialobject. - Throws:
NullPointerException- Ifkeyisnull.IllegalArgumentException- Ifkeyis an empty string.
-