AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAssets::common::DavsServiceMock Class Reference

#include <DavsServiceMock.h>

Public Types

using FilterMap = commonInterfaces::DavsRequest::FilterMap
 

Public Member Functions

 DavsServiceMock ()
 
virtual ~DavsServiceMock ()
 
void uploadBinaryArtifact (const std::string &type, const std::string &key, const FilterMap &metadata, const std::string &filePath, std::chrono::milliseconds ttlDelta, const std::string &id="")
 
void uploadBase64Artifact (const std::string &type, const std::string &key, const FilterMap &metadata, const std::string &encodedBinary, std::chrono::milliseconds ttlDelta, const std::string &id="")
 

Static Public Member Functions

static std::string getId (const FilterMap &map)
 

Member Typedef Documentation

◆ FilterMap

Constructor & Destructor Documentation

◆ DavsServiceMock()

alexaClientSDK::acsdkAssets::common::DavsServiceMock::DavsServiceMock ( )

◆ ~DavsServiceMock()

alexaClientSDK::acsdkAssets::common::DavsServiceMock::~DavsServiceMock ( )
virtual

Member Function Documentation

◆ getId()

string alexaClientSDK::acsdkAssets::common::DavsServiceMock::getId ( const FilterMap map)
static

◆ uploadBase64Artifact()

void alexaClientSDK::acsdkAssets::common::DavsServiceMock::uploadBase64Artifact ( const std::string &  type,
const std::string &  key,
const FilterMap metadata,
const std::string &  encodedBinary,
std::chrono::milliseconds  ttlDelta,
const std::string &  id = "" 
)

◆ uploadBinaryArtifact()

void alexaClientSDK::acsdkAssets::common::DavsServiceMock::uploadBinaryArtifact ( const std::string &  type,
const std::string &  key,
const FilterMap metadata,
const std::string &  filePath,
std::chrono::milliseconds  ttlDelta,
const std::string &  id = "" 
)

This mimics the step of uploading artifact to DAVS. See https://w.amazon.com/bin/view/DeviceArtifactVendingService/DAVS2.0_SOP/#HPUTAPI-Uploadartifact

Parameters
typethe type of artifact such as "wakeword" or "fingerprint"
keythe key such as "alexa" or "amazon"
filterMapordered map of filters
filePathabsolute path to a file to upload, such as "/tmp/file.tar.gz"
ttlDeltathe delta time from current time when artifact expires
idOPTIONAL, id of the artifact as it sits in the cloud, if not provided, then a concatination of key+type+metadata is used

Some analysis of fields expected by actual publishing call and how it affects the flow and if it matters to our mocking: clientArtifactId: DAVS expects that publisher creates the ID; we'll create the ID automatically by using the type_key_locale artifactMD5Checksum: DAVS uses this for validation of the upload; we don't care and we'll not use artifactKey: we'll use 'key' supplied by the consumer of this API; will be returned in response artifactType: we'll use 'type'; will be returned in response uploaderId: ignored description: ignored contentLength: we'll populate automatically and return in response artifactTimeToLive: we'll use supplied delta from current time metadata: given by the consumer of this API

After this method is called, it is expected that CURL request to https://api.amazonalexa.com/v2/deviceArtifacts/?artifactFilter=<request> will inspect the <request> part and return a response JSON containing following valid fields: "artifactSize" will be the size of the local file "artifactKey" and "artifactType" will be the same as given here (BTW, client side doesn't care right now but might in future for further validation) "artifactTimeToLive" and "urlExpiryEpoch" will be currentTime + given delta, returned in MS like DAVS does "artifactIdentifier" will be the ID generated by this API and will internally be stored in /tmp/davs_service_mock "downloadUrl" will be something like "https://device-artifacts-v2.s3.amazonaws.com/type-key-ID.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180919T223612Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIAJTPKJI7A3WTMPCQQ%2F20180919%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=87160eda6c8325e9ce61120974cdf2f81c4b8a3d47c1192f6cf4b7500ed17165"

Once client issues a request to that download URL, it is expected that the content of the original file pointed to by filePath is returned. Once uploadBinaryArtifact() completes, the file is no longer needed and can be deleted. DAVS will make its own copy.


The documentation for this class was generated from the following files:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0