-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hi,
I'm trying to get volume id with the following code but always get "400" error (bad request):
ClientConfiguration config;
config.scheme = Scheme::HTTPS;
config.connectTimeoutMs = 30000;
config.requestTimeoutMs = 30000;
auto client = Aws::MakeShared("Test", config);
Filter f1, f2;
f1.SetName("tag:Name"); f1.AddValues("TestData");
f2.SetName("attachment.instance-id"); f2.AddValues(getInstanceId());
DescribeVolumesRequest req;
req.AddFilters(f1);
req.AddFilters(f2);
DescribeVolumesOutcome out = client->DescribeVolumes(req);
if (out.IsSuccess())
{
Aws::Vector vols = out.GetResult().GetVolumes();
if (vols[0].GetState() != VolumeState::in_use)
{
LOGGER->Log("Volume is busy");
return std::string();
}
return vols[0].GetVolumeId().c_str();
}
LOGGER->Log("DescribeVolumeRequest Error: %s", out.GetError().GetMessage().c_str());
return std::string();
Could someone please shed some light what I have been missing?
Thanks,
Johnny