@ComponentProfile(summary="Builds an authorization header for Azure CosmosDB",
since="3.9.2",
tag="azure,cosmosdb,cosmos")
public class CosmosAuthorizationHeaderFromUrl
extends CosmosAuthorizationHeaderImpl
This differs from CosmosAuthorizationHeader in that it parses the URL for an appropriate ResourceID and ResourceType.
Once it has figured out an appropriate resourceID and ResourceType it builds an instance of CosmosAuthorizationHeader and
executes it. Note that if the URL convention changes for Azure CosmosDB, then this service may well generate an incorrect
ResourceType/ResourceID; you may still need to use CosmosAuthorizationHeader directly.
Given this example list of URLS; then then corresponding ResourceType / ResourceIDs will be generated. Essentially if the number
of path fragments is even then the ResourceID is full path, and the ResourceType is the penultimate fragment; if the
number of path fragments is odd then the ResourceID is everything up to the last / and the ResoucrceType is the
last fragment.
| URL example | ResourceType | ResourceID |
|---|---|---|
| https://azuredb.microsoft.com/ | "" (the service will fail; since ResourceType must be set) |
"" |
| https://azuredb.microsoft.com/dbs | dbs |
"" |
| https://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs | docs |
dbs/tmpdb/colls/tempcoll |
| https://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs/MyName | docs |
dbs/tempdb/colls/tempcoll/docs/MyName |
| https://azuredb.microsoft.com/dbs/tempdb/colls | colls |
dbs/tempdb |
In the adapter configuration file this class is aliased as cosmosdb-authorization-header-from-url which is the preferred alternative to the fully qualified classname when building your configuration.
DEFAULT_METADATA_KEY, X_MS_DATElogCONFIRMATION_ID_KEY| Constructor and Description |
|---|
CosmosAuthorizationHeaderFromUrl() |
| Modifier and Type | Method and Description |
|---|---|
void |
doService(AdaptrisMessage msg) |
@NonNull java.lang.String |
getCosmosEndpointUrl()
The Cosmos URL Endpoint that you will be hitting with your REST request.
|
void |
prepare() |
void |
setCosmosEndpointUrl(@NonNull java.lang.String cosmosEndpointUrl)
The Cosmos URL Endpoint that you will be hitting with your REST request.
|
CosmosAuthorizationHeaderFromUrl |
withCosmosEndpointUrl(java.lang.String s) |
closeService, getHttpVerb, getMasterKey, getTargetKey, initService, setHttpVerb, setMasterKey, setTargetKey, targetKey, withHttpVerb, withMasterKey, withTargetKeychangeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stoppublic void prepare()
throws CoreException
prepare in interface ComponentLifecycleExtensionprepare in class CosmosAuthorizationHeaderImplCoreExceptionpublic void doService(AdaptrisMessage msg) throws ServiceException
ServiceExceptionpublic CosmosAuthorizationHeaderFromUrl withCosmosEndpointUrl(java.lang.String s)
@NonNull public @NonNull java.lang.String getCosmosEndpointUrl()
public void setCosmosEndpointUrl(@NonNull
@NonNull java.lang.String cosmosEndpointUrl)