AWS SDK for C++

AWS SDK for C++ Version 1.11.778

Loading...
Searching...
No Matches
DynamoDBWaiter.h
1
6#pragma once
7#include <aws/core/utils/Waiter.h>
8#include <aws/core/utils/memory/AWSMemory.h>
9#include <aws/dynamodb/DynamoDBClient.h>
10#include <aws/dynamodb/model/ContributorInsightsStatus.h>
11#include <aws/dynamodb/model/DescribeContributorInsightsRequest.h>
12#include <aws/dynamodb/model/DescribeContributorInsightsResult.h>
13#include <aws/dynamodb/model/DescribeExportRequest.h>
14#include <aws/dynamodb/model/DescribeExportResult.h>
15#include <aws/dynamodb/model/DescribeImportRequest.h>
16#include <aws/dynamodb/model/DescribeImportResult.h>
17#include <aws/dynamodb/model/DescribeKinesisStreamingDestinationRequest.h>
18#include <aws/dynamodb/model/DescribeKinesisStreamingDestinationResult.h>
19#include <aws/dynamodb/model/DescribeTableRequest.h>
20#include <aws/dynamodb/model/DescribeTableResult.h>
21#include <aws/dynamodb/model/DestinationStatus.h>
22#include <aws/dynamodb/model/ExportStatus.h>
23#include <aws/dynamodb/model/ImportStatus.h>
24#include <aws/dynamodb/model/TableStatus.h>
25
26#include <algorithm>
27
28namespace Aws {
29namespace DynamoDB {
30
31template <typename DerivedClient = DynamoDBClient>
33 public:
40 "ContributorInsightsEnabledWaiter", Aws::Utils::WaiterState::SUCCESS, Aws::String("ENABLED"),
41 [](const Model::DescribeContributorInsightsOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
42 if (!outcome.IsSuccess()) return false;
43 const auto& result = outcome.GetResult();
44 return Model::ContributorInsightsStatusMapper::GetNameForContributorInsightsStatus(result.GetContributorInsightsStatus()) ==
45 expected.get<Aws::String>();
46 }));
48 "ContributorInsightsEnabledWaiter", Aws::Utils::WaiterState::FAILURE, Aws::String("FAILED"),
49 [](const Model::DescribeContributorInsightsOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
50 if (!outcome.IsSuccess()) return false;
51 const auto& result = outcome.GetResult();
52 return Model::ContributorInsightsStatusMapper::GetNameForContributorInsightsStatus(result.GetContributorInsightsStatus()) ==
53 expected.get<Aws::String>();
54 }));
55
56 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeContributorInsights(req); };
57 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilContributorInsightsEnabled");
58 return waiter.Wait(request);
59 }
60
62 using OutcomeT = Model::DescribeExportOutcome;
63 using RequestT = Model::DescribeExportRequest;
66 "ExportCompletedWaiter", Aws::Utils::WaiterState::SUCCESS, Aws::String("COMPLETED"),
67 [](const Model::DescribeExportOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
68 if (!outcome.IsSuccess()) return false;
69 const auto& result = outcome.GetResult();
70 return Model::ExportStatusMapper::GetNameForExportStatus(result.GetExportDescription().GetExportStatus()) ==
71 expected.get<Aws::String>();
72 }));
74 "ExportCompletedWaiter", Aws::Utils::WaiterState::FAILURE, Aws::String("FAILED"),
75 [](const Model::DescribeExportOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
76 if (!outcome.IsSuccess()) return false;
77 const auto& result = outcome.GetResult();
78 return Model::ExportStatusMapper::GetNameForExportStatus(result.GetExportDescription().GetExportStatus()) ==
79 expected.get<Aws::String>();
80 }));
81
82 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeExport(req); };
83 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilExportCompleted");
84 return waiter.Wait(request);
85 }
86
88 using OutcomeT = Model::DescribeImportOutcome;
89 using RequestT = Model::DescribeImportRequest;
92 "ImportCompletedWaiter", Aws::Utils::WaiterState::SUCCESS, Aws::String("COMPLETED"),
93 [](const Model::DescribeImportOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
94 if (!outcome.IsSuccess()) return false;
95 const auto& result = outcome.GetResult();
96 return Model::ImportStatusMapper::GetNameForImportStatus(result.GetImportTableDescription().GetImportStatus()) ==
97 expected.get<Aws::String>();
98 }));
100 "ImportCompletedWaiter", Aws::Utils::WaiterState::FAILURE, Aws::String("FAILED"),
101 [](const Model::DescribeImportOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
102 if (!outcome.IsSuccess()) return false;
103 const auto& result = outcome.GetResult();
104 return Model::ImportStatusMapper::GetNameForImportStatus(result.GetImportTableDescription().GetImportStatus()) ==
105 expected.get<Aws::String>();
106 }));
108 "ImportCompletedWaiter", Aws::Utils::WaiterState::FAILURE, Aws::String("CANCELLED"),
109 [](const Model::DescribeImportOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
110 if (!outcome.IsSuccess()) return false;
111 const auto& result = outcome.GetResult();
112 return Model::ImportStatusMapper::GetNameForImportStatus(result.GetImportTableDescription().GetImportStatus()) ==
113 expected.get<Aws::String>();
114 }));
115
116 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeImport(req); };
117 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilImportCompleted");
118 return waiter.Wait(request);
119 }
120
127 "KinesisStreamingDestinationActiveWaiter", Aws::Utils::WaiterState::SUCCESS, Aws::String("ACTIVE"),
128 [](const Model::DescribeKinesisStreamingDestinationOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
129 if (!outcome.IsSuccess()) return false;
130 const auto& result = outcome.GetResult();
131 return std::any_of(result.GetKinesisDataStreamDestinations().begin(), result.GetKinesisDataStreamDestinations().end(),
132 [&](const Model::KinesisDataStreamDestination& item) {
133 return Model::DestinationStatusMapper::GetNameForDestinationStatus(item.GetDestinationStatus()) ==
134 expected.get<Aws::String>();
135 });
136 }));
138 "KinesisStreamingDestinationActiveWaiter", Aws::Utils::WaiterState::FAILURE, true,
139 [](const Model::DescribeKinesisStreamingDestinationOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
140 if (!outcome.IsSuccess()) return false;
141 const auto& result = outcome.GetResult();
142 return ((result.GetKinesisDataStreamDestinations().size() > 0) &&
143 (static_cast<std::size_t>(std::count_if(
144 result.GetKinesisDataStreamDestinations().begin(), result.GetKinesisDataStreamDestinations().end(),
146 return (
147 (Model::DestinationStatusMapper::GetNameForDestinationStatus(item.GetDestinationStatus()) == "DISABLED") ||
148 (Model::DestinationStatusMapper::GetNameForDestinationStatus(item.GetDestinationStatus()) == "ENABLE_FAILED"));
149 })) == result.GetKinesisDataStreamDestinations().size())) == expected.get<bool>();
150 }));
151
152 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeKinesisStreamingDestination(req); };
153 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilKinesisStreamingDestinationActive");
154 return waiter.Wait(request);
155 }
156
158 using OutcomeT = Model::DescribeTableOutcome;
159 using RequestT = Model::DescribeTableRequest;
162 "TableExistsWaiter", Aws::Utils::WaiterState::SUCCESS, Aws::String("ACTIVE"),
163 [](const Model::DescribeTableOutcome& outcome, const Aws::Utils::ExpectedValue& expected) -> bool {
164 if (!outcome.IsSuccess()) return false;
165 const auto& result = outcome.GetResult();
166 return Model::TableStatusMapper::GetNameForTableStatus(result.GetTable().GetTableStatus()) == expected.get<Aws::String>();
167 }));
168 acceptors.emplace_back(Aws::MakeUnique<Aws::Utils::ErrorAcceptor<OutcomeT>>("TableExistsWaiter", Aws::Utils::WaiterState::RETRY,
169 Aws::String("ResourceNotFoundException")));
170
171 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeTable(req); };
172 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilTableExists");
173 return waiter.Wait(request);
174 }
175
177 using OutcomeT = Model::DescribeTableOutcome;
178 using RequestT = Model::DescribeTableRequest;
180 acceptors.emplace_back(Aws::MakeUnique<Aws::Utils::ErrorAcceptor<OutcomeT>>("TableNotExistsWaiter", Aws::Utils::WaiterState::SUCCESS,
181 Aws::String("ResourceNotFoundException")));
182
183 auto operation = [this](const RequestT& req) { return static_cast<DerivedClient*>(this)->DescribeTable(req); };
184 Aws::Utils::Waiter<RequestT, OutcomeT> waiter(20, 6, std::move(acceptors), operation, "WaitUntilTableNotExists");
185 return waiter.Wait(request);
186 }
187};
188} // namespace DynamoDB
189} // namespace Aws
Aws::Utils::WaiterOutcome< Model::DescribeExportOutcome > WaitUntilExportCompleted(const Model::DescribeExportRequest &request)
Aws::Utils::WaiterOutcome< Model::DescribeTableOutcome > WaitUntilTableNotExists(const Model::DescribeTableRequest &request)
Aws::Utils::WaiterOutcome< Model::DescribeTableOutcome > WaitUntilTableExists(const Model::DescribeTableRequest &request)
Aws::Utils::WaiterOutcome< Model::DescribeImportOutcome > WaitUntilImportCompleted(const Model::DescribeImportRequest &request)
Aws::Utils::WaiterOutcome< Model::DescribeContributorInsightsOutcome > WaitUntilContributorInsightsEnabled(const Model::DescribeContributorInsightsRequest &request)
Aws::Utils::WaiterOutcome< Model::DescribeKinesisStreamingDestinationOutcome > WaitUntilKinesisStreamingDestinationActive(const Model::DescribeKinesisStreamingDestinationRequest &request)
bool IsSuccess() const
const R & GetResult() const
WaiterOutcome< OutcomeT > Wait(const RequestT &request)
AWS_DYNAMODB_API Aws::String GetNameForContributorInsightsStatus(ContributorInsightsStatus value)
AWS_DYNAMODB_API Aws::String GetNameForExportStatus(ExportStatus value)
AWS_DYNAMODB_API Aws::String GetNameForImportStatus(ImportStatus value)
AWS_DYNAMODB_API Aws::String GetNameForTableStatus(TableStatus value)
Aws::Utils::Outcome< DescribeExportResult, DynamoDBError > DescribeExportOutcome
Aws::Utils::Outcome< DescribeTableResult, DynamoDBError > DescribeTableOutcome
Aws::Utils::Outcome< DescribeContributorInsightsResult, DynamoDBError > DescribeContributorInsightsOutcome
Aws::Utils::Outcome< DescribeImportResult, DynamoDBError > DescribeImportOutcome
Aws::Utils::Outcome< DescribeKinesisStreamingDestinationResult, DynamoDBError > DescribeKinesisStreamingDestinationOutcome
Crt::Variant< int, bool, Aws::String > ExpectedValue
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
UniquePtr< T > MakeUnique(const char *allocationTag, ArgTypes &&... args)
std::vector< T, Aws::Allocator< T > > Vector