testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
Loading...
Searching...
No Matches
testcontainers::Volume::Builder Class Reference

A copyable builder for a richer named volume: driver, driver options, and labels. More...

#include <testcontainers/Volume.hpp>

Public Member Functions

Builderwith_name (std::string name)
Builderwith_driver (std::string driver)
Builderwith_driver_opt (std::string key, std::string value)
 Add a driver option (DriverOpts). Add several to set multiple options.
Builderwith_label (std::string key, std::string value)
 Add a volume label (Labels).
Volume create () const
 Create the volume from the configured options, returning the handle.

Detailed Description

A copyable builder for a richer named volume: driver, driver options, and labels.

Defined in std types only (no Boost/json leak through the header).

The with_* setters mutate in place and return *this by reference; a single unqualified overload chains on both a named lvalue and a temporary. create() assembles the spec, runs the Reaper hook, and creates the volume.

Member Function Documentation

◆ with_name()

Builder & testcontainers::Volume::Builder::with_name ( std::string name)
inline

◆ with_driver()

Builder & testcontainers::Volume::Builder::with_driver ( std::string driver)
inline

◆ with_driver_opt()

Builder & testcontainers::Volume::Builder::with_driver_opt ( std::string key,
std::string value )
inline

Add a driver option (DriverOpts). Add several to set multiple options.

◆ with_label()

Builder & testcontainers::Volume::Builder::with_label ( std::string key,
std::string value )
inline

Add a volume label (Labels).

The testcontainers session labels are always merged in by create() for Ryuk reaping.

◆ create()

Volume testcontainers::Volume::Builder::create ( ) const

Create the volume from the configured options, returning the handle.