Access Library - Files

Access.h

///
/// file Access.h
///
/// \brief Access API header file
///
/// Copyright (c) 2019 AnyConnect Private Limited. All rights reserved.
///

#ifndef _ACCESS_
#define _ACCESS_

#include \<string>
#include \<utility>
#include \<memory>
#include \<functional>
#include \<vector>
#include \<cstdint>
#include \<ctime>
#include \<map>
#include \<cctype>
#include \<iomanip>
#include \<sstream>

#include "AccessTypes.h"

namespace com {         /// \namespace com
namespace anyconnect {  /// \namespace anyconnect
namespace access {      /// \namespace access

using namespace com::anyconnect::access::types;

///
/// \brief Access allows communication with other Access endpoints through
/// use of AnyConnect's service.
///
class Access {
public:
    typedef std::shared_ptr\<Access> Ptr;
    virtual ~Access() {}

    ///
    /// Makes this endpoint appear online to other endpoints with association.
    /// Registered callbacks will get invoked as soon as start is called.
    /// Callback invocation may begin before start() returns so all necessary
    /// initialization must be performed before start is called.
    ///
    /// After start has been called, additional callback registration can result in immediate
    /// invocation.
    ///
    /// \return - AccessRet::OK when started Access successfully, other values on failure.
    ///
    virtual AccessRet start() = 0;

    ///
    /// Makes the endpoint invisible to other endpoints. Callbacks in progress can still be
    /// invoked. The API will asynchronously return the status through async callback.
    ///
    /// \param[in] callback - Callback handler that will return the invocation result asynchronously.
    ///                       No other callbacks will be invoked after this callback is called.
    ///
    virtual void stop(ApiStatusCallback callback) = 0;

    ///
    /// Fetch the pairing token. Device will use this token to pair with this endpoint.
    /// This API can be invoked from App only.
    ///
    /// \param[in] callback - Asynchronous callback function that shall return the token.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getPairingToken(PairingTokenCallback callback) = 0;

    ///
    /// Retrieves the endpoint information for an specified endpoint.
    ///
    /// \param[in] endpointId - Id of the endpoint to fetch info. Possible value may be self Id
    ///                         or Id of some endpoint with association.
    /// \param[in] callback   - Asynchronous callback function that shall return endpoint info.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getEndpointInfo(const Endpoint endpointId, EndpointInfoCallback callback) = 0;

    ///
    /// Returns endpoint info from cache.
    ///
    /// \param[out] userId       - Owner user id for the calling endpoint.
    /// \param[out] endpointId   - Endpoint id for the calling endpoint.
    /// \param[out] endpointType - Endpoint type for the calling endpoint.
    ///
    virtual void getSelfEndpointInfo(uint64_t& userId, Endpoint& endpointId, EndpointType& endpointType) = 0;

    ///
    /// Updates the endpoint information for the specific endpoint.
    ///
    /// \param[in] endpointId  - Id of the endpoint to update name. Possible value may be self Id
    ///                          or Id of some endpoint with association.
    /// \param[in] endpointInfo - EndpointInfo instance containing updated endpoint information.
    /// \param[in] callback - Asynchronous callback function that shall return the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet updateEndpointInfo(const Endpoint endpointId, const std::shared_ptr\<types::EndpointUpdateRequest> endpointInfo, ApiStatusCallback callback) = 0;

    ///
    /// Retrieves user infomation. Calling endpoint must have sufficient privilege.
    ///
    /// \param[in] userId   - Id of the user to fetch info.
    /// \param[in] callback - Asynchronous callback function that shall return user info.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getUserInfo(const uint64_t userId, UserInfoCallback callback) = 0;

    ///
    /// Updates the self user information. The calling endpoint must be an user.
    ///
    /// \param[in] updatedName - New user name.
    /// \param[in] callback    - Asynchronous callback function that shall return the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet updateUserInfo(const std::string updatedName, ApiStatusCallback callback) = 0;

    ///
    /// Associate an endpoint with an specific user.
    ///
    /// \param[in] endpointId - Id of the endpoint intending to share.
    /// \param[in] userEmail  - Email of the user with whom to share the endpoint.
    /// \param[in] role      - Role of the specified user on the specified endpoint.
    /// \param[in] callback   - Asynchronous callback function that shall return
    ///                         the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet associateEndpoint(Endpoint endpointId, std::string userEmail, PeerRole role, ApiStatusCallback callback) = 0;

    ///
    /// Asynchronously returns the list of associated endpoints.
    ///
    /// \param[in] callback - Asynchronous callback function that shall return the endpoint list.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getAssociatedEndpoints(AssociatedEndpointCallback callback) = 0;

    ///
    /// Asynchronously returns the associated users.
    ///
    /// \param[in] callback - Asynchronous callback function that shall return the endpoint list.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getAssociatedUsers(Endpoint endpointId, AssociatedUserCallback callback) = 0;

    ///
    /// Update the role of an user over an already associated endpoint.
    ///
    /// \param[in] endpointId - Id of the target endpoint.
    /// \param[in] userId   - Id of the user for whom to update the role.
    /// \param[in] role    - New role of the specified user on the specified endpoint.
    /// \param[in] callback - Asynchronous callback function that shall return
    ///                       the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet updateAssociationRole(Endpoint endpointId, uint64_t userId, PeerRole role, ApiStatusCallback callback) = 0;

    ///
    /// Removes the association of an user from an specific endpoint.
    /// This will result in removing the access control entry and prevent any further operation
    /// on the endpoint by the calling user.
    ///
    /// \param[in] endpointId - Id of the target endpoint.
    /// \param[in] userId   - Id of the user for whom the association should be removed.
    /// \param[in] callback - Asynchronous callback function that shall return
    ///                       the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet removeAssociation(Endpoint endpointId, uint64_t userId, ApiStatusCallback callback) = 0;

    ///
    /// Retrieves presence status for a set of endpoints.
    ///
    /// \param[in] endpoints - A set of endpoints to retrive presence status.
    /// \param[in] callback  - Asynchronous callback function that shall return presence status.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getPresence(const std::vector\<types::Endpoint>& endpoints, PresenceStatusCallback callback) = 0;

    ///
    /// Sends events to the associated endpoints.
    ///
    /// \param[in] eventType - Type of the event, e.g. "com.example.detection.face".
    /// \param[in] eventDescription - Event description.
    /// \param[in] callback  - Asynchronous callback function that shall return
    ///                        the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet sendEvent(const std::string& eventType, const std::string& eventDescription, ApiStatusCallback callback) = 0;

    ///
    /// Sends message to an specific endpoint.
    ///
    /// \param[in] data     - Message data to send.
    /// \param[in] callback - Optional asynchronous callback function that shall return
    ///                       the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet sendMessage(const MessageData data, ApiStatusCallback callback = nullptr) = 0;

    ///
    /// Sends a signal.
    ///
    /// \param[in] data     - Signal data to send.
    /// \param[in] callback - Asynchronous callback function that shall return
    ///                       the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet sendSignal(const SignalType signal, const SignalData data, sendSignalCallback callback) = 0;

    ///
    /// Updateds a connection details.
    ///
    /// \param[in] isInitiator - Indicates the endpoint which connection initiated.
    /// \param[in] connectionDetails - Details of the connection.
    /// \param[in] callback     - Asynchronous callback function that shall return
    ///                           the invocation result when callback is set.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet updateConnectionDetails(bool isInitiator, const ConnectionDetails connectionDetails, ApiStatusCallback callback = nullptr) = 0;

    ///
    /// Retrieves the recorded media Url for an specific endpoint.
    ///
    /// \param[in] endpointId     - Endpoint Id to retrieve the recorded media.
    /// \param[in] startingTime   - Starting time in seconds (epoch unix time: 1560167845).
    /// \param[in] callback       - Asynchronous callback function that shall return
    ///                             the invocation result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getRecordedMediaUrl(Endpoint endpointId, int64_t startingTime, RecordingUrlsCallback callback) = 0;

    ///
    /// Returns the STUN and TURN server configuration.
    ///
    /// \param[in] callback - Asynchronous callback function that shall return the result.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getServerConfiguration(ServerConfigurationCallback callback) = 0;

    ///
    /// Sets properties for the calling endpoint.
    ///
    /// \param[in] props    - types::Properties instance holding key-value properties to be set.
    /// \param[in] callback - Asynchronous callback handler that shall return invocation status.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet setProperties(const types::Properties props, ApiStatusCallback callback) = 0;

    ///
    /// Retrieves properties of an specified endpoint.
    ///
    /// \param[in] endpointId - Target endpoint id to retrieve properties.
    /// \param[in] callback   - Asynchronous callback handler that shall return endpoint properties.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getProperties(Endpoint endpointId, EndpointPropertiesCallback callback) = 0;

    ///
    /// Retrieves available package version.
    ///
    /// \param[in] packageVariant - Type of the package variant
    /// \param[out] callback   - Asynchronous callback handler that shall return latest version of package details.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getAvailablePackageVersion(std::string packageVariant, AvailablePackageVersionCallback callback) = 0;

    ///
    /// Retrieves available package version.
    ///
    ///\param[in] Continuation Token to get continues data. Keep this field empty to get 
    /// entries from beginning. In order to resume the query at the next item in the result
    /// set, please provide the continuation token retrieved from previous query
    /// \param[in] deviceGrouName - device group name
    /// \param[out] callback   - Asynchronous callback handler that shall return available AI models of the group of deivce
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///

    virtual AccessRet getAvailableAIContainer(std::string continuationToken, int64_t groupId, GetAvailableAIContainerCallback callback) = 0;

    ///
    /// Retrieves available package variants.
    ///
    /// \param[out] callback   - Asynchronous callback handler that shall return available package variants.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getPackageVariants(AvailablePackageVariantsCallback callback) = 0;

    ///
    /// Post Sensor samples.
    ///
    /// \param[in] sensorReports   - List of Sensor Samples. Recommended max List size 30.
    /// \param[in] callback - Asynchronous callback handler that shall return status of the post operation
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet postSensorSamples(std::vector\<std::shared_ptr\<SensorReport>> sensorReports, ApiStatusCallback callback) = 0;

    ///
    /// Retrieves available package version.
    ///
    /// \param[out] callback   - Asynchronous callback handler that shall return current version of package.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getSelfVersion(GetPackageVersionCallback callback) = 0;

    ///
    /// Retrieves available package version.
    ///
    /// \param[out] callback   - Asynchronous callback handler that shall return current version of package.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getVersion(GetVersionCallback callback) = 0;

    ///
    /// Retrieves available package version.
    ///
    /// \param[in] version	   - version to be udpated
    /// \param[in] variant     - package variant in use
    /// \param[out] callback   - Asynchronous callback handler that shall return status of setting version.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet setSelfVersion(const std::string version, const std::string variant, ApiStatusCallback callback) = 0;

    ///
    /// update or set package version.
    ///
    /// \param[in] version	   - version to be udpated
    /// \param[out] callback   - Asynchronous callback handler that shall return status of setting version.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet setVersion(const std::string version, ApiStatusCallback callback) = 0;


    ///
    /// Post a report to console.
    ///
    /// \param[in] props    - Report properties in key/value form.
    /// \param[in] type     - A predefined report type.
    /// \param[in] severity - Severity of the diagnostic report.
    /// \param[in] module   - Module that is posting the diagnostic report.
    /// \param[in] summary  - Summary text of the report.
    /// \param[in] delay    - Delay in ms when the report originally occurred.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual bool postReports(const Properties props, const ReportType type, const ReportSeverity severity, const ReportModule module, const std::string summary, std::uint32_t delay = 0) = 0;

    ///
    /// Register callback function to receive specific type of message.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when the specific message is received.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerMessageCallback(std::string messageType, MessageCallback callback) = 0;

    ///
    /// Register callback function to receive signals.
    ///
    /// \param[in] signal     - SignalType for which callback should set.
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when the specific message is received.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerSignalCallback(types::SignalType signal, SignalDataCallback callback) = 0;

    ///
    /// Register callback function to receive presence notification for the associated endpoints.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when presence status changes for the associated endpoints.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerPresenceChangeCallback(PresenceChangeCallback callback) = 0;

    ///
    /// Register callback function to receive notification when caller endpoints
    /// role is changed on any of the associated endpoints.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when role changes.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerRoleChangeCallback(RoleChangeCallback callback) = 0;

    ///
    /// Register callback function to receive notification when any associated endpoint is reset.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when an associated endpoint is reset.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerEndpointResetCallback(ResetCallback callback) = 0;

    ///
    /// Register callback function to receive notification on change of endpoint info
    /// (e.g. Name, Image URL) for associated endpoints.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when endpoint info is changed on any of the associated endpoints.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerEndpointInfoChangeCallback(InfoChangeCallback callback) = 0;

    ///
    /// Register callback function to receive notification on self connection status.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when self connectivity status changes.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerSelfConnectionChangeCallback(SelfConnectionCallback callback) = 0;

    ///
    /// Register callback function that shall be invoked on Access fall into
    /// severe internal error. When this callback is invoked, client should stop
    /// and restart (stop, initialize and start)
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerErrorCallback(ApiStatusCallback callback) = 0;

    ///
    /// Register callback function to receive system events generated by
    /// event plugin library.
    ///
    /// \param[in] callback - Asynchronous callback handler that shall be invoked
    ///                       when event fired by event library.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet registerSystemEventListener(SystemEventCallback callback) = 0;

    ///
    /// Deactivates an user. All user specific info is removed from the server. Moreover, it resets all
    //  the endpoints this user owns. This is a blocking API.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet deactivateUser() = 0;

    ///
    /// Removes an specific endpoint from Anyconnect system. This is a blocking API.
    ///
    /// \param[in] endpointId - Endpoint Id to reset. The caller must have sufficient privilege.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet resetEndpoint(Endpoint endpointId) = 0;

    ///
    /// Retrieves list of (10) events for an Endpoint.
    ///
    /// \param[in] endpointId - Target endpoint id to retrieve events.
    /// \param[in] pageSize - Expected size of the list. Specified size should be between
    /// between 10 to 100. If the size is beyond this limit, closest default size will be used
    /// \param[in] continuationToken - For initial call, it must be empty. for subsequent
    /// call (to get data continuation) set the value from the most recent success response
    ///
    /// \param[out] callback - Asynchronous callback handler that shall be invoked
    ///                       when the events are available.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getEvents(const Endpoint endpointId, int pageSize, std::string continuationToken, EventsListCallback callback) = 0;

    ///
    /// Retrieves list of sensor samples for an Endpoint.
    ///
    /// \param[in] endpointId - Target endpoint id to retrieve events.
    /// \param[in] pageSize - Expected size of the list. Specified size should be between
    /// between 10 to 100. If the size is beyond this limit, closest default size will be used
    /// \param[in] sensorReportType - Type of sensor
    /// \param[in] continuationToken - For initial call, it must be empty. for subsequent
    /// call (to get data continuation) set the value from the most recent success response
    /// \param[in] fromDate - Start date of the sample
    /// \param[in] toDate - End date of the sample
    ///
    /// \param[out] callback - Asynchronous callback handler that shall be invoked
    ///                       when the events are available.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getSensorSamples(const Endpoint endpointId,
                                          int32_t pageSize,
                                          std::string sensorReportType,
                                          std::string continuationToken,
                                          std::string fromDate,
                                          std::string toDate,
                                          SensorSampleCallback callback
                                          ) = 0;

    ///
    /// Remove the calling endpoint from Anyconnect system.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet resetSelf() = 0;

    ///
    /// Logout current active user
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///

    virtual AccessRet logout() = 0;

    ///
    /// post stream quality report
    ///
    /// \param[in] connectionId - ConnectionId of the stream
    /// \param[in] streamQualityProfiles - List of StreamQualityProfile instance
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet postStreamQuality(std::string connectionId, std::vector\<std::shared_ptr\<types::StreamQualityProfile>> streamQualityProfileList, PostStreamQualityCallback callback) = 0;

    ///
    /// Get resource groups
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet getResourceGroups(GetResourceGroupsCallback callback) = 0;

    ///
    /// Get network status
    ///
    /// \return - true if netowork is connected, false otherwise
    ///
    virtual bool hasConnectivity() = 0;
    

    /// Get app versions
    ///
    ///
    /// \param[in] continuationToken - Continuation Token to get continues data. 
    /// Keep this field empty to get entries from beginning. In order to resume the query 
    /// at the next item in the result set, please provide the continuation token retrieved 
    /// from previous query
    /// \param[in] platform - Must be ANDROID or IOS.
    /// \param[in] fromDate - Data after this date will be retrieved. Date format is epoch time milliseconds
    /// \param[in] toDate - Data up to this date will be retrieved. Date format is epoch time milliseconds
    ///
    /// \return - OK is successful, other values in failure
    ///
    virtual AccessRet getAppVersion(std::string continuationToken, std::string platform, std::string fromDate, std::string toDate, GetAppVersionCallback callback) = 0;

    /// Get deployed firmware
    ///
    ///\param[in] continuationToken - Continuation Token to get continues data. 
    /// Keep this field empty to get entries from beginning. In order to resume 
    /// the query at the next item in the result set, please provide the continuation 
    /// token retrieved from previous query
    ///\param[in] groupId - A unique Group ID
    ///\param[in] fromDate - Data after this date will be retrieved. Date format is epoch time milliseconds
    ///\param[in] toDate - Data up to this date will be retrieved. Date format is epoch time milliseconds
    ///
    /// \return - OK if successful, other values on failure
    virtual AccessRet getDeployedFirmwares(std::string continuationToken, int64_t groupId, std::string fromDate, std::string toDate, GetDeployedFirmwaresCallback callback) = 0;


    /// Get deployed firmware
    ///
    ///\param[in] endpointId - Endpoint id
    ///\param[in] continuationToken - Continuation Token to get continues data. 
    /// Keep this field empty to get entries from beginning. In order to resume 
    /// the query at the next item in the result set, please provide the continuation 
    /// token retrieved from previous query
    ///
    /// \return - OK if successful, other values on failure
    virtual AccessRet checkFirmwareUpdate(int64_t endpointId, std::string continuationToken, CheckFirmwareUpdateCallback callback) = 0;

    /// Get events of an endpoint
    ///
    ///\param[in] endpointId - Endpoint id
    ///\param[in] continuationToken - Continuation Token to get continues data. 
    /// Keep this field empty to get entries from beginning. In order to resume 
    /// the query at the next item in the result set, please provide the continuation 
    /// token retrieved from previous query
    ///
    /// \return - OK if successful, other values on failure
    virtual AccessRet getEventsForEndpoint(int64_t endpointId, std::string continuationToken, GetEventsForEndpointCallback callback) = 0;

    /// Get capability of an endpoint
    ///
    ///\param[in] endpointId - Endpoint id to fetch capability of
    ///
    ///\return - OK if successful, other values on failure
    virtual AccessRet getEndpointCapabilities(int64_t endpointId, GetEndpointCapabilityCallback callback) = 0;

    ///
    /// Report capabilities of different stack
    ///

    /// Report general system info
    virtual AccessRet reportCapabilities(const reporting::SystemInfo& caps) = 0;

    // /// Report system health
    virtual AccessRet reportCapabilities(const reporting::SystemHealth& caps) = 0;

    // /// Report endpoint related info
    virtual AccessRet reportCapabilities(const reporting::EndpointData& caps) = 0;

    // /// Report encoder capabilities
    virtual AccessRet reportCapabilities(const reporting::CameraCaps& caps) = 0;

    // /// Report sensor capabilities
    virtual AccessRet reportCapabilities(const reporting::SensorCaps& caps) = 0;

    // /// Report connectivity capabilities
    virtual AccessRet reportCapabilities(const reporting::ConnectivityCaps& caps) = 0;

    // /// Report Device capabilities
    virtual AccessRet reportCapabilities(const reporting::EdgeDeviceCaps& caps) = 0;

      /// Returns a list of aicontainer
    ///
    /// \return - OK if successful, other values on failure
    virtual AccessRet getDeployedAIContainer(GetDeployedAIContainerCallback callback) = 0;

    /// Returns a list of model
    ///\param[in] containerId - A unique container id
    ///\param[in] pageSize - Expected size of the list. Specified size should be between
    /// between 10 to 100. If the size is beyond this limit, closest default size will be used
    ///\param[in] continuationToken - Continuation Token to get continues data.
    /// Keep this field empty to get entries from beginning. In order to resume
    /// the query at the next item in the result set, please provide the continuation
    /// token retrieved from previous query
    ///
    ///\return - OK if successful, other values on failure
    virtual AccessRet getDeployedAIModels(std::string containerid, int32_t pageSize, std::string continuationToken, GetDeployedAIModelsCallback callback) = 0;
};

///
/// Builder object to configure and create an Access instance.
///
class AccessBuilder {

public:

    ///
    /// Returns a shared pointer pointing to a valid AccessBuilder instance.
    ///
    static std::shared_ptr\<AccessBuilder> getBuilder();

    virtual ~AccessBuilder() {}

    ///
    /// Sets the provisioning credentials. Should be used for App onboarding.
    ///
    /// \param[in] email                  - Email of the App user.
    /// \param[in] loginToken             - Token received by the email provider after successful login.
    /// \param[in] emailProvider          - Name of the email provider (e.g. Gmail, Facebook, Samsung).
    /// \param[in] domain                 - Domain name of email provider.
    /// \param[in] tenantId               - Tenant Id of the user.
    /// \param[in] endpointName           - Name of the endpoint.
    /// \param[in] deviceUniqueIdentifier - Unique identifier for the calling machine. This should not
    ///                                     change for a certain machine.
    ///
    virtual AccessRet fieldProvisionApp(const std::string email, const std::string loginToken,
                                        const std::string emailProvider, const std::string domain,
                                        const std::string tenantId,
                                        const std::string endpointName, const std::string deviceUniqueIdentifier) = 0;

    ///
    /// Sets the provisioning credentials. Should be used for Device onboarding.
    ///
    /// \param[in] userId                 - User Id of the user attempting to pair.
    /// \param[in] pairingToken           - Token received from the user attempting to pair.
    /// \param[in] endpointName           - Name of the endpoint.
    /// \param[in] deviceUniqueIdentifier - Unique identifier for the calling machine. This should not
    ///                                     change for a certain machine.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet fieldProvisionDevice(const uint64_t userId, std::string pairingToken,
                                            const std::string endpointName, const std::string deviceUniqueIdentifier) = 0;

    ///
    /// Provision an Endpoint when Endpoint Id and Secret are already available.
    ///
    /// \param[in] endpointId     - Endpoint Id of this Endpoint.
    /// \param[in] endpointSecret - Endpoint secret of this Endpoint.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet factoryProvisionEndpoint(const Endpoint endpointId, const std::string endpointSecret) = 0;

    ///
    /// Sets the provisioning credentials. Should be used for Device onboarding.
    ///
    /// \param[in] endpointName           - Name of the endpoint.
    /// \param[in] deviceUniqueIdentifier - Unique identifier for the calling machine. This should not
    ///                                     change for a certain machine.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet selfProvisionDevice(const std::string endpointName, const std::string deviceUniqueIdentifier) = 0;

    ///
    /// Returns the endpoint Id.
    ///
    virtual Endpoint getEndpointId() const = 0;

    ///
    /// Returns the Endpoint type. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual types::EndpointType getEndpointType() const = 0;

    ///
    /// Returns the Endpoint secret set by client.
    ///
    virtual std::string getEndpointSecret() const = 0;

    ///
    /// Returns the Endpoint name. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getEndpointName() const = 0;

    ///
    /// Returns the user Id of the owner. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual uint64_t getUserId() const = 0;

    ///
    /// Returns the owner username. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getUserName() const = 0;

    ///
    /// Returns the email of the calling endpoint's owner. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getEmail() const = 0;

    ///
    /// Returns the domain name of the email provider set by client.
    /// This info is updated by Access with the data in the server during Access instantiation
    /// when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getDomain() const = 0;

    ///
    /// Returns the tenant Id. This info is updated by Access with the data in the server
    /// during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getTenantId() const = 0;

    ///
    /// Returns the image Url for this endpoint. This info is updated by Access with the data
    /// in the server during Access instantiation when AccessBuilder::build() API is invoked.
    ///
    virtual std::string getImageUrl() const = 0;

    ///
    /// Returns the Anyconnect REST server URL.
    ///
    virtual std::string getBaseUrl() const = 0;

    ///
    /// Sets the local directory path for the cache.
    ///
    /// \return - AccessRet::OK if successful, other values on failure.
    ///
    virtual AccessRet setCacheDirectory(const std::string path) = 0;

    ///
    /// Returns the current local directory path for the cache set by client.
    ///
    virtual std::string getCacheDirectory() const = 0;

    ///
    /// Constructs an Access instance.
    ///
    /// throws std::runtime_error
    ///
    /// \return In success, returns Access::Ptr containing Access instance. In failure, returns null Access::Ptr.
    /// On exception, std::runtime_error::what() API will provide the reason for the exception.
    ///
    virtual Access::Ptr build() = 0;

#if defined(JNI_SUPPORT_ENABLED)
    ///
    /// Sets the Java virtual machine reference.
    ///
    /// Android MUST call this api before build api to make build successful.
    ///
    virtual void setJavaVM(JavaVM* vm) = 0;

    ///
    /// Returns the Java virtual machine reference.
    ///
    virtual JavaVM* getJavaVM() = 0;
#endif

};

} //access
} //anyconnect
} //com

#endif //_ACCESS_