Skip to content

Commit bb648d2

Browse files
authored
Fix invoke service operation for smithy clients (#3811)
* Add codegen for smithy InvokeServiceOperation * Updated smithy clients
1 parent cce628c commit bb648d2

24 files changed

Lines changed: 2534 additions & 7597 deletions

File tree

generated/src/aws-cpp-sdk-bedrock-agent-runtime/include/aws/bedrock-agent-runtime/BedrockAgentRuntimeClient.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,12 @@ class AWS_BEDROCKAGENTRUNTIME_API BedrockAgentRuntimeClient
10691069

10701070
private:
10711071
friend class Aws::Client::ClientWithAsyncTemplateMethods<BedrockAgentRuntimeClient>;
1072+
1073+
typedef Aws::Utils::Outcome<Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>, BedrockAgentRuntimeError> InvokeOperationOutcome;
1074+
1075+
InvokeOperationOutcome InvokeServiceOperation(const AmazonWebServiceRequest& request,
1076+
const std::function<void(Aws::Endpoint::AWSEndpoint&)>& resolveUri,
1077+
Aws::Http::HttpMethod httpMethod) const;
10721078
};
10731079

10741080
} // namespace BedrockAgentRuntime

generated/src/aws-cpp-sdk-bedrock-agent-runtime/source/BedrockAgentRuntimeClient.cpp

Lines changed: 268 additions & 654 deletions
Large diffs are not rendered by default.

generated/src/aws-cpp-sdk-bedrock-agent/include/aws/bedrock-agent/BedrockAgentClient.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,6 +2187,12 @@ class AWS_BEDROCKAGENT_API BedrockAgentClient
21872187

21882188
private:
21892189
friend class Aws::Client::ClientWithAsyncTemplateMethods<BedrockAgentClient>;
2190+
2191+
typedef Aws::Utils::Outcome<Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>, BedrockAgentError> InvokeOperationOutcome;
2192+
2193+
InvokeOperationOutcome InvokeServiceOperation(const AmazonWebServiceRequest& request,
2194+
const std::function<void(Aws::Endpoint::AWSEndpoint&)>& resolveUri,
2195+
Aws::Http::HttpMethod httpMethod) const;
21902196
};
21912197

21922198
} // namespace BedrockAgent

generated/src/aws-cpp-sdk-bedrock-agent/source/BedrockAgentClient.cpp

Lines changed: 736 additions & 1821 deletions
Large diffs are not rendered by default.

generated/src/aws-cpp-sdk-bedrock-data-automation-runtime/include/aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntimeClient.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API BedrockDataAutomationRuntimeClient
256256

257257
private:
258258
friend class Aws::Client::ClientWithAsyncTemplateMethods<BedrockDataAutomationRuntimeClient>;
259+
260+
typedef Aws::Utils::Outcome<Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>, BedrockDataAutomationRuntimeError>
261+
InvokeOperationOutcome;
262+
263+
InvokeOperationOutcome InvokeServiceOperation(const AmazonWebServiceRequest& request, Aws::Http::HttpMethod httpMethod) const;
259264
};
260265

261266
} // namespace BedrockDataAutomationRuntime

generated/src/aws-cpp-sdk-bedrock-data-automation-runtime/source/BedrockDataAutomationRuntimeClient.cpp

Lines changed: 42 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -146,153 +146,63 @@ void BedrockDataAutomationRuntimeClient::OverrideEndpoint(const Aws::String& end
146146
m_clientConfiguration.endpointOverride = endpoint;
147147
m_endpointProvider->OverrideEndpoint(endpoint);
148148
}
149-
GetDataAutomationStatusOutcome BedrockDataAutomationRuntimeClient::GetDataAutomationStatus(
150-
const GetDataAutomationStatusRequest& request) const {
151-
AWS_OPERATION_GUARD(GetDataAutomationStatus);
152-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, GetDataAutomationStatus, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
153-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetDataAutomationStatus, CoreErrors, CoreErrors::NOT_INITIALIZED);
154-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
155-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
156-
AWS_OPERATION_CHECK_PTR(meter, GetDataAutomationStatus, CoreErrors, CoreErrors::NOT_INITIALIZED);
157-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".GetDataAutomationStatus",
158-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
159-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
149+
BedrockDataAutomationRuntimeClient::InvokeOperationOutcome BedrockDataAutomationRuntimeClient::InvokeServiceOperation(
150+
const AmazonWebServiceRequest& request, Aws::Http::HttpMethod httpMethod) const {
151+
auto operationName = request.GetServiceRequestName();
152+
auto serviceName = GetServiceClientName();
153+
154+
AWS_OPERATION_GUARD_DYNAMIC(operationName);
155+
156+
AWS_OPERATION_CHECK_PTR_DYNAMIC(m_clientConfiguration.telemetryProvider, operationName, CoreErrors, CoreErrors::NOT_INITIALIZED);
157+
158+
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(serviceName, {});
159+
auto meter = m_clientConfiguration.telemetryProvider->getMeter(serviceName, {});
160+
AWS_OPERATION_CHECK_PTR_DYNAMIC(meter, operationName, CoreErrors, CoreErrors::NOT_INITIALIZED);
161+
162+
auto span = tracer->CreateSpan(Aws::String(serviceName) + "." + operationName,
163+
{{TracingUtils::SMITHY_METHOD_DIMENSION, operationName},
164+
{TracingUtils::SMITHY_SERVICE_DIMENSION, serviceName},
160165
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
161166
smithy::components::tracing::SpanKind::CLIENT);
162-
return TracingUtils::MakeCallWithTiming<GetDataAutomationStatusOutcome>(
163-
[&]() -> GetDataAutomationStatusOutcome {
167+
168+
return TracingUtils::MakeCallWithTiming<InvokeOperationOutcome>(
169+
[&]() -> InvokeOperationOutcome {
164170
auto result =
165-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
171+
MakeRequestDeserialize(&request, operationName, httpMethod,
166172
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
167-
return result.IsSuccess() ? GetDataAutomationStatusOutcome(result.GetResultWithOwnership())
168-
: GetDataAutomationStatusOutcome(std::move(result.GetError()));
173+
return result.IsSuccess() ? InvokeOperationOutcome(result.GetResultWithOwnership())
174+
: InvokeOperationOutcome(std::move(result.GetError()));
169175
},
170176
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
171-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
172-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
177+
{{TracingUtils::SMITHY_METHOD_DIMENSION, operationName}, {TracingUtils::SMITHY_SERVICE_DIMENSION, serviceName}});
178+
}
179+
GetDataAutomationStatusOutcome BedrockDataAutomationRuntimeClient::GetDataAutomationStatus(
180+
const GetDataAutomationStatusRequest& request) const {
181+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
182+
return result.IsSuccess() ? GetDataAutomationStatusOutcome(result.GetResultWithOwnership())
183+
: GetDataAutomationStatusOutcome(std::move(result.GetError()));
173184
}
174-
175185
InvokeDataAutomationOutcome BedrockDataAutomationRuntimeClient::InvokeDataAutomation(const InvokeDataAutomationRequest& request) const {
176-
AWS_OPERATION_GUARD(InvokeDataAutomation);
177-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, InvokeDataAutomation, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
178-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, InvokeDataAutomation, CoreErrors, CoreErrors::NOT_INITIALIZED);
179-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
180-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
181-
AWS_OPERATION_CHECK_PTR(meter, InvokeDataAutomation, CoreErrors, CoreErrors::NOT_INITIALIZED);
182-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".InvokeDataAutomation",
183-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
184-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
185-
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
186-
smithy::components::tracing::SpanKind::CLIENT);
187-
return TracingUtils::MakeCallWithTiming<InvokeDataAutomationOutcome>(
188-
[&]() -> InvokeDataAutomationOutcome {
189-
auto result =
190-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
191-
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
192-
return result.IsSuccess() ? InvokeDataAutomationOutcome(result.GetResultWithOwnership())
193-
: InvokeDataAutomationOutcome(std::move(result.GetError()));
194-
},
195-
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
196-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
197-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
186+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
187+
return result.IsSuccess() ? InvokeDataAutomationOutcome(result.GetResultWithOwnership())
188+
: InvokeDataAutomationOutcome(std::move(result.GetError()));
198189
}
199-
200190
InvokeDataAutomationAsyncOutcome BedrockDataAutomationRuntimeClient::InvokeDataAutomationAsync(
201191
const InvokeDataAutomationAsyncRequest& request) const {
202-
AWS_OPERATION_GUARD(InvokeDataAutomationAsync);
203-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, InvokeDataAutomationAsync, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
204-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, InvokeDataAutomationAsync, CoreErrors, CoreErrors::NOT_INITIALIZED);
205-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
206-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
207-
AWS_OPERATION_CHECK_PTR(meter, InvokeDataAutomationAsync, CoreErrors, CoreErrors::NOT_INITIALIZED);
208-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".InvokeDataAutomationAsync",
209-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
210-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
211-
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
212-
smithy::components::tracing::SpanKind::CLIENT);
213-
return TracingUtils::MakeCallWithTiming<InvokeDataAutomationAsyncOutcome>(
214-
[&]() -> InvokeDataAutomationAsyncOutcome {
215-
auto result =
216-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
217-
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
218-
return result.IsSuccess() ? InvokeDataAutomationAsyncOutcome(result.GetResultWithOwnership())
219-
: InvokeDataAutomationAsyncOutcome(std::move(result.GetError()));
220-
},
221-
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
222-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
223-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
192+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
193+
return result.IsSuccess() ? InvokeDataAutomationAsyncOutcome(result.GetResultWithOwnership())
194+
: InvokeDataAutomationAsyncOutcome(std::move(result.GetError()));
224195
}
225-
226196
ListTagsForResourceOutcome BedrockDataAutomationRuntimeClient::ListTagsForResource(const ListTagsForResourceRequest& request) const {
227-
AWS_OPERATION_GUARD(ListTagsForResource);
228-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, ListTagsForResource, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
229-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListTagsForResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
230-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
231-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
232-
AWS_OPERATION_CHECK_PTR(meter, ListTagsForResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
233-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".ListTagsForResource",
234-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
235-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
236-
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
237-
smithy::components::tracing::SpanKind::CLIENT);
238-
return TracingUtils::MakeCallWithTiming<ListTagsForResourceOutcome>(
239-
[&]() -> ListTagsForResourceOutcome {
240-
auto result =
241-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
242-
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
243-
return result.IsSuccess() ? ListTagsForResourceOutcome(result.GetResultWithOwnership())
244-
: ListTagsForResourceOutcome(std::move(result.GetError()));
245-
},
246-
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
247-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
248-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
197+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
198+
return result.IsSuccess() ? ListTagsForResourceOutcome(result.GetResultWithOwnership())
199+
: ListTagsForResourceOutcome(std::move(result.GetError()));
249200
}
250-
251201
TagResourceOutcome BedrockDataAutomationRuntimeClient::TagResource(const TagResourceRequest& request) const {
252-
AWS_OPERATION_GUARD(TagResource);
253-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, TagResource, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
254-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, TagResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
255-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
256-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
257-
AWS_OPERATION_CHECK_PTR(meter, TagResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
258-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".TagResource",
259-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
260-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
261-
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
262-
smithy::components::tracing::SpanKind::CLIENT);
263-
return TracingUtils::MakeCallWithTiming<TagResourceOutcome>(
264-
[&]() -> TagResourceOutcome {
265-
auto result =
266-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
267-
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
268-
return result.IsSuccess() ? TagResourceOutcome(result.GetResultWithOwnership()) : TagResourceOutcome(std::move(result.GetError()));
269-
},
270-
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
271-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
272-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
202+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
203+
return result.IsSuccess() ? TagResourceOutcome(result.GetResultWithOwnership()) : TagResourceOutcome(std::move(result.GetError()));
273204
}
274-
275205
UntagResourceOutcome BedrockDataAutomationRuntimeClient::UntagResource(const UntagResourceRequest& request) const {
276-
AWS_OPERATION_GUARD(UntagResource);
277-
AWS_OPERATION_CHECK_PTR(m_endpointProvider, UntagResource, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE);
278-
AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, UntagResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
279-
auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {});
280-
auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {});
281-
AWS_OPERATION_CHECK_PTR(meter, UntagResource, CoreErrors, CoreErrors::NOT_INITIALIZED);
282-
auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".UntagResource",
283-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
284-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()},
285-
{TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE}},
286-
smithy::components::tracing::SpanKind::CLIENT);
287-
return TracingUtils::MakeCallWithTiming<UntagResourceOutcome>(
288-
[&]() -> UntagResourceOutcome {
289-
auto result =
290-
MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST,
291-
[&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { AWS_UNREFERENCED_PARAM(resolvedEndpoint); });
292-
return result.IsSuccess() ? UntagResourceOutcome(result.GetResultWithOwnership())
293-
: UntagResourceOutcome(std::move(result.GetError()));
294-
},
295-
TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,
296-
{{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()},
297-
{TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}});
206+
auto result = InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_POST);
207+
return result.IsSuccess() ? UntagResourceOutcome(result.GetResultWithOwnership()) : UntagResourceOutcome(std::move(result.GetError()));
298208
}

generated/src/aws-cpp-sdk-bedrock-data-automation/include/aws/bedrock-data-automation/BedrockDataAutomationClient.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,12 @@ class AWS_BEDROCKDATAAUTOMATION_API BedrockDataAutomationClient
859859

860860
private:
861861
friend class Aws::Client::ClientWithAsyncTemplateMethods<BedrockDataAutomationClient>;
862+
863+
typedef Aws::Utils::Outcome<Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>, BedrockDataAutomationError> InvokeOperationOutcome;
864+
865+
InvokeOperationOutcome InvokeServiceOperation(const AmazonWebServiceRequest& request,
866+
const std::function<void(Aws::Endpoint::AWSEndpoint&)>& resolveUri,
867+
Aws::Http::HttpMethod httpMethod) const;
862868
};
863869

864870
} // namespace BedrockDataAutomation

0 commit comments

Comments
 (0)