Exposes AWS-backed website features to server-side JS, registered as the awsManager service. Wraps AwsManager's CloudFront and ACM certificate handling, Route 53 hosted zone lookups, and Textract document and expense analysis behind plain maps and lists, so app code can call these AWS operations without handling AWS SDK types directly. ACM certificate lookups are cached briefly per website to reduce the number of calls made to CloudFront.

Group: Managers


Methods

getCertificateForWebsite(Website website) · requestAcmCertificate(Website website) · deleteCertificate(Website website) · setCertificateActive(Website website) · getHostedZoneById(String hzId) · getHostedZoneByName(String dnsName) · getHostedZoneDelegationById(String hzId) · getHostedZoneRecordSet(String hzId) · getCloudFrontDetails(Website website) · updateWebsiteHostedZone(Website website) · startExpenseAnalysis(FileItem fileItem) · startExpenseAnalysis(byte[] fileBytes) · startExpenseAnalysis(InputStream in) · getExpenseAnalysis(String jobId) · analyzeExpense(FileItem fileItem) · analyzeExpense(byte[] fileBytes) · analyzeExpense(InputStream in) · analyzeExpense(InputStream in, Long contentLength) · startDocumentAnalysis(FileItem fileItem, DocumentAnalysisBuilder builder) · startDocumentAnalysis(byte[] fileBytes, DocumentAnalysisBuilder builder) · startDocumentAnalysis(InputStream in, DocumentAnalysisBuilder builder) · startDocumentAnalysis(InputStream in, Long contentLength, DocumentAnalysisBuilder builder) · analyzeDocument(byte[] fileBytes, DocumentAnalysisBuilder builder) · analyzeDocument(FileItem fileItem, DocumentAnalysisBuilder builder) · analyzeDocument(InputStream in, DocumentAnalysisBuilder builder) · analyzeDocument(InputStream in, Long contentLength, DocumentAnalysisBuilder builder) · getDocumentAnalysis(String jobId) · newDocumentAnalysisBuilder() · toMap(ToCopyableBuilder tcb) · toList(Collection<? extends ToCopyableBuilder> tcb)

getCertificateForWebsite(Website website)

Returns: Map<String,Object>

Looks up the ACM certificate for a website's CloudFront custom domain, converted to a plain map. Results are cached for fifteen seconds per website ID so repeated calls do not hit CloudFront each time.

ParameterDescription
websitethe website whose custom domain certificate is looked up

requestAcmCertificate(Website website)

Returns: void

Requests a new ACM certificate for the website's custom domain and clears the cached certificate status for the website so the next read reflects the pending request.

ParameterDescription
websitethe website whose custom domain the certificate is requested for

deleteCertificate(Website website)

Returns: boolean

Deletes the ACM certificate for the website, also removing it from the CloudFront distribution, and clears the cached certificate status for the website.

ParameterDescription
websitethe website whose certificate is deleted

setCertificateActive(Website website)

Returns: void

Activates a previously requested ACM certificate for the website's custom domain, and clears the cached certificate status for the website so the next read reflects the change.

ParameterDescription
websitethe website whose certificate is activated

getHostedZoneById(String hzId)

Returns: Map<String,Object>

Looks up a Route 53 hosted zone by ID, converted to a plain map. Returns null if the hosted zone is not one of the current organisation's registered hosted zones.

ParameterDescription
hzIdthe Route 53 hosted zone ID to look up

getHostedZoneByName(String dnsName)

Returns: Map<String,Object>

Looks up the current organisation's Route 53 hosted zone for a domain name, converted to a plain map.

ParameterDescription
dnsNamethe domain name to find the hosted zone for

getHostedZoneDelegationById(String hzId)

Returns: Map<String,Object>

Looks up the full Route 53 hosted zone details, including its delegation set of name servers, converted to a plain map. Returns null if the hosted zone is not one of the current organisation's registered hosted zones.

ParameterDescription
hzIdthe Route 53 hosted zone ID to look up

getHostedZoneRecordSet(String hzId)

Returns: List<Map<String,Object>>

Lists the DNS records in a Route 53 hosted zone, each converted to a plain map. Returns null if the hosted zone is not one of the current organisation's registered hosted zones.

ParameterDescription
hzIdthe Route 53 hosted zone ID whose records are listed

getCloudFrontDetails(Website website)

Returns: Map<String,Object>

Looks up the CloudFront distribution serving a website, returning its ID, domain name and status as a plain map. Returns null if the website has no CloudFront distribution.

ParameterDescription
websitethe website whose CloudFront distribution is looked up

updateWebsiteHostedZone(Website website)

Returns: Map<String,Object>

Updates the Route 53 hosted zone for the website's domain name so its DNS records match the website's current configuration, converted to a plain map.

ParameterDescription
websitethe website whose hosted zone is updated; must have a non-blank domain name

startExpenseAnalysis(FileItem fileItem)

Returns: String

Uploads the file to S3 and starts an asynchronous Textract expense analysis job for it, such as a receipt or invoice. Use getExpenseAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
fileItemthe uploaded file to analyse

startExpenseAnalysis(byte[] fileBytes)

Returns: String

Uploads the file content to S3 and starts an asynchronous Textract expense analysis job for it. Use getExpenseAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
fileBytesthe raw content of the document to analyse

startExpenseAnalysis(InputStream in)

Returns: String

Uploads the stream's content to S3 and starts an asynchronous Textract expense analysis job for it. Use getExpenseAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
ina stream over the document content to analyse

getExpenseAnalysis(String jobId)

Returns: GetExpenseAnalysisResponse

Fetches the result of a Textract expense analysis job started with startExpenseAnalysis.

ParameterDescription
jobIdthe job ID returned by startExpenseAnalysis

analyzeExpense(FileItem fileItem)

Returns: AnalyzeExpenseResponse

Uploads the file to S3 and synchronously runs Textract expense analysis on it, blocking until the result is available. Prefer startExpenseAnalysis for larger documents to avoid a long-running call.

ParameterDescription
fileItemthe uploaded file to analyse

analyzeExpense(byte[] fileBytes)

Returns: AnalyzeExpenseResponse

Uploads the file content to S3 and synchronously runs Textract expense analysis on it, blocking until the result is available. Prefer startExpenseAnalysis for larger documents to avoid a long-running call.

ParameterDescription
fileBytesthe raw content of the document to analyse

analyzeExpense(InputStream in)

Returns: AnalyzeExpenseResponse

Uploads the stream's content to S3 and synchronously runs Textract expense analysis on it, blocking until the result is available. Prefer startExpenseAnalysis for larger documents to avoid a long-running call.

ParameterDescription
ina stream over the document content to analyse

analyzeExpense(InputStream in, Long contentLength)

Returns: AnalyzeExpenseResponse

Uploads the stream's content, of the given length, to S3 and synchronously runs Textract expense analysis on it, blocking until the result is available. Prefer startExpenseAnalysis for larger documents to avoid a long-running call.

ParameterDescription
ina stream over the document content to analyse
contentLengththe length in bytes of the stream content

startDocumentAnalysis(FileItem fileItem, DocumentAnalysisBuilder builder)

Returns: String

Uploads the file to S3 and starts an asynchronous Textract document analysis job for it, extracting the features and queries configured on the builder. Use getDocumentAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
fileItemthe uploaded file to analyse
builderthe features and queries to run against the document

startDocumentAnalysis(byte[] fileBytes, DocumentAnalysisBuilder builder)

Returns: String

Uploads the file content to S3 and starts an asynchronous Textract document analysis job for it, extracting the features and queries configured on the builder. Use getDocumentAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
fileBytesthe raw content of the document to analyse
builderthe features and queries to run against the document

startDocumentAnalysis(InputStream in, DocumentAnalysisBuilder builder)

Returns: String

Uploads the stream's content to S3 and starts an asynchronous Textract document analysis job for it, extracting the features and queries configured on the builder. Use getDocumentAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
ina stream over the document content to analyse
builderthe features and queries to run against the document

startDocumentAnalysis(InputStream in, Long contentLength, DocumentAnalysisBuilder builder)

Returns: String

Uploads the stream's content, of the given length, to S3 and starts an asynchronous Textract document analysis job for it, extracting the features and queries configured on the builder. Use getDocumentAnalysis with the returned job ID to retrieve the result once it completes.

ParameterDescription
ina stream over the document content to analyse
contentLengththe length in bytes of the stream content
builderthe features and queries to run against the document

analyzeDocument(byte[] fileBytes, DocumentAnalysisBuilder builder)

Returns: AnalyzeDocumentResponse

Uploads the file content to S3 and synchronously runs Textract document analysis on it, extracting the features and queries configured on the builder and blocking until the result is available. Prefer startDocumentAnalysis for larger documents to avoid a long-running call.

ParameterDescription
fileBytesthe raw content of the document to analyse
builderthe features and queries to run against the document

analyzeDocument(FileItem fileItem, DocumentAnalysisBuilder builder)

Returns: AnalyzeDocumentResponse

Uploads the file to S3 and synchronously runs Textract document analysis on it, extracting the features and queries configured on the builder and blocking until the result is available. Prefer startDocumentAnalysis for larger documents to avoid a long-running call.

ParameterDescription
fileItemthe uploaded file to analyse
builderthe features and queries to run against the document

analyzeDocument(InputStream in, DocumentAnalysisBuilder builder)

Returns: AnalyzeDocumentResponse

Uploads the stream's content to S3 and synchronously runs Textract document analysis on it, extracting the features and queries configured on the builder and blocking until the result is available. Prefer startDocumentAnalysis for larger documents to avoid a long-running call.

ParameterDescription
ina stream over the document content to analyse
builderthe features and queries to run against the document

analyzeDocument(InputStream in, Long contentLength, DocumentAnalysisBuilder builder)

Returns: AnalyzeDocumentResponse

Uploads the stream's content, of the given length, to S3 and synchronously runs Textract document analysis on it, extracting the features and queries configured on the builder and blocking until the result is available. Prefer startDocumentAnalysis for larger documents to avoid a long-running call.

ParameterDescription
ina stream over the document content to analyse
contentLengththe length in bytes of the stream content
builderthe features and queries to run against the document

getDocumentAnalysis(String jobId)

Returns: GetDocumentAnalysisResponse

Fetches the result of a Textract document analysis job started with startDocumentAnalysis.

ParameterDescription
jobIdthe job ID returned by startDocumentAnalysis

newDocumentAnalysisBuilder()

Returns: DocumentAnalysisBuilder

Creates a new, empty builder for configuring the features and queries to run in a call to startDocumentAnalysis or analyzeDocument.

toMap(ToCopyableBuilder tcb)

Returns: Map<String,Object>

Converts an AWS SDK response object to a plain map by round-tripping it through its builder and JSON, so app code can read AWS results without depending on AWS SDK types. Dates are serialised in ISO format.

ParameterDescription
tcbthe AWS SDK response object to convert

toList(Collection<? extends ToCopyableBuilder> tcb)

Returns: List<Map<String,Object>>

Converts a collection of AWS SDK response objects to a list of plain maps, one per element, using toMap.

ParameterDescription
tcbthe AWS SDK response objects to convert
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.