CRUD Service

class ydk::CrudService

CRUD Service class for supporting CRUD operations on entities.

CrudService()
bool create(ydk::ServiceProvider &provider, Entity &entity)

Create the entity.

Parameters:
  • provider – An instance of ServiceProvider.
  • entity – An instance of Entity class defined under a bundle.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.

bool create(ydk::ServiceProvider &provider, std::vector<Entity *> &entities)

Create multiple entities.

Parameters:
  • provider – An instance of ServiceProvider.
  • entities – An instance of std::vector<Entity*> class, which contains one or more entities.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.

std::shared_ptr<ydk::Entity> read(ydk::ServiceProvider &provider, Entity &filter)

Read configuration and state data for specified filter.

Parameters:
  • provider – An instance of ServiceProvider.
  • filter – An instance of entity class defined under a bundle.
Returns:

A pointer to an instance of Entity as identified by the filter if successful, nullptr - otherwise.

Raises:

YError, if an error has occurred.

std::vector<std::shared_ptr<Entity>> read(ydk::ServiceProvider &provider, std::vector<Entity *> &filters)

Read configuration and state data for specified filter.

Parameters:
  • provider – An instance of ServiceProvider.
  • filter – An instance of std::vector<Entity*> class, which contains one or more entities defined under a bundle.
Returns:

An instance of std::vector<std::shared_ptr<Entity>> as identified by the filters if successful, instance of empty std::vector - otherwise.

Raises:

YError, if an error has occurred.

std::shared_ptr<ydk::Entity> read_config(ydk::ServiceProvider &provider, Entity &filter)

Read only configuration data for specified filter.

Parameters:
  • provider – An instance of ServiceProvider.
  • filter – An instance of entity class defined under a bundle.
Returns:

A pointer to an instance of Entity as identified by the filter if successful, nullptr - otherwise.

Raises:

YError, if an error has occurred.

std::vector<std::shared_ptr<Entity>> read_config(ydk::ServiceProvider &provider, std::vector<Entity *> &filters)

Read only configuration data for specified filter.

Parameters:
  • provider – An instance of ServiceProvider.
  • filters – An instance of std::vector<Entity*> class, which contains one or more entities defined under a bundle.
Returns:

An instance of std::vector<std::shared_ptr<Entity>> as identified by the filters if successful, instance of empty std::vector - otherwise.

Raises:

YError, if an error has occurred.

bool update(ydk::ServiceProvider &provider, Entity &entity)

Update the entity.

Parameters:
  • provider – An instance of ServiceProvider.
  • entity – An instance of Entity class defined under a bundle.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.

bool update(ydk::ServiceProvider &provider, std::vector<Entity *> &entities)

Update multiple entities.

Parameters:
  • provider – An instance of ServiceProvider.
  • entities – An instance of std::vector<Entity*> class, which contains one or more entities defined under a bundle.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.

bool delete_(ydk::ServiceProvider &provider, Entity &entity)

Delete the entity.

Parameters:
  • provider – An instance of ServiceProvider.
  • entity – An instance of Entity class defined under a bundle.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.

bool delete_(ydk::ServiceProvider &provider, std::vector<Entity *> &entities)

Delete multiple entities.

Parameters:
  • provider – An instance of ServiceProvider.
  • entity – An instance of std::vector<Entity*> class, which contains one or more entities defined under a bundle.
Returns:

true, if successful, false - otherwise.

Raises:

YError, if an error has occurred.