Class CosmosAuthorizationHeaderFromUrl
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.interlok.azure.cosmosdb.CosmosAuthorizationHeaderImpl
-
- com.adaptris.interlok.azure.cosmosdb.CosmosAuthorizationHeaderFromUrl
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Builds an authorization header for Azure CosmosDB", since="3.9.2", tag="azure,cosmosdb,cosmos") public class CosmosAuthorizationHeaderFromUrl extends CosmosAuthorizationHeaderImplBuilds an authorization header for Azure CosmosDB from a URL.This differs from
CosmosAuthorizationHeaderin 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 ofCosmosAuthorizationHeaderand 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 useCosmosAuthorizationHeaderdirectly.Given this example list of URLS; then then corresponding ResourceType / ResourceIDs will be generated. Essentially if the number of path fragments is
eventhen the ResourceID is full path, and the ResourceType is the penultimate fragment; if the number of path fragments isoddthen 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 docsdbs/tmpdb/colls/tempcollhttps://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs/MyName docsdbs/tempdb/colls/tempcoll/docs/MyNamehttps://azuredb.microsoft.com/dbs/tempdb/colls collsdbs/tempdbIn 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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.interlok.azure.cosmosdb.CosmosAuthorizationHeaderImpl
DEFAULT_METADATA_KEY, X_MS_DATE
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description CosmosAuthorizationHeaderFromUrl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoService(AdaptrisMessage msg)@NonNull java.lang.StringgetCosmosEndpointUrl()The Cosmos URL Endpoint that you will be hitting with your REST request.voidprepare()voidsetCosmosEndpointUrl(@NonNull java.lang.String cosmosEndpointUrl)The Cosmos URL Endpoint that you will be hitting with your REST request.CosmosAuthorizationHeaderFromUrlwithCosmosEndpointUrl(java.lang.String s)-
Methods inherited from class com.adaptris.interlok.azure.cosmosdb.CosmosAuthorizationHeaderImpl
closeService, getHttpVerb, getMasterKey, getTargetKey, initService, setHttpVerb, setMasterKey, setTargetKey, targetKey, withHttpVerb, withMasterKey, withTargetKey
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
prepare
public void prepare() throws CoreException- Specified by:
preparein interfaceComponentLifecycleExtension- Overrides:
preparein classCosmosAuthorizationHeaderImpl- Throws:
CoreException
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
- Throws:
ServiceException
-
withCosmosEndpointUrl
public CosmosAuthorizationHeaderFromUrl withCosmosEndpointUrl(java.lang.String s)
-
getCosmosEndpointUrl
@NonNull public @NonNull java.lang.String getCosmosEndpointUrl()
The Cosmos URL Endpoint that you will be hitting with your REST request.
-
setCosmosEndpointUrl
public void setCosmosEndpointUrl(@NonNull @NonNull java.lang.String cosmosEndpointUrl)The Cosmos URL Endpoint that you will be hitting with your REST request.
-
-