|
1 | | -#if($metadata.protocol == "ec2" || $metadata.protocol == "json" || $metadata.protocol == "query" || $metadata.protocol == "smithy-rpc-v2-cbor") |
2 | | - #set($emitGenericOperation = true) |
3 | | - #parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientOperationRequestRequiredMemberValidate.vm") |
| 1 | +#set($emitGenericOperation = true) |
| 2 | +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientOperationRequestRequiredMemberValidate.vm") |
| 3 | +#set($emitGenericOperation = false) |
| 4 | + |
| 5 | +#if($serviceModel.metadata.serviceId == "EC2") |
| 6 | +#set($presignSpelling = "PresignedUrl") |
| 7 | +#set($shouldGenerateUrl = "request.SourceRegionHasBeenSet()") |
| 8 | +#else |
| 9 | +#set($presignSpelling = "PreSignedUrl") |
| 10 | +#set($shouldGenerateUrl = "request.SourceRegionHasBeenSet() && !request.${presignSpelling}HasBeenSet()") |
| 11 | +#end |
| 12 | + |
| 13 | +## |
| 14 | +## Handle presigned URL generation if the operation requires it |
| 15 | +## |
| 16 | + |
| 17 | +#if($operation.hasPreSignedUrl) |
| 18 | + if (${shouldGenerateUrl}) { |
| 19 | + ${operation.request.shape.name} newRequest = request; |
| 20 | + Aws::Endpoint::EndpointParameters endpointParameters; |
| 21 | +#if($operation.staticContextParams) |
| 22 | +#foreach($staticParamPair in $operation.staticContextParams.entrySet()) |
| 23 | + parameters.emplace_back(Aws::String("${staticParamPair.key}"), ${staticParamPair.value.get("value").getValue()}); |
| 24 | +#end |
| 25 | +#end |
| 26 | + endpointParameters.emplace_back(Aws::Endpoint::EndpointParameter("Region", request.GetSourceRegion())); |
| 27 | + ResolveEndpointOutcome presignedEndpointResolutionOutcome = m_endpointProvider->ResolveEndpoint(endpointParameters); |
| 28 | + AWS_OPERATION_CHECK_SUCCESS(presignedEndpointResolutionOutcome, ${operation.name}, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, presignedEndpointResolutionOutcome.GetError().GetMessage()); |
| 29 | + newRequest.Set${presignSpelling}(GeneratePresignedUrl(request, presignedEndpointResolutionOutcome.GetResult().GetURI(), |
| 30 | + Aws::Http::HttpMethod::HTTP_GET, request.GetSourceRegion().c_str(), |
| 31 | + {{ "DestinationRegion", m_region }}, 3600)); |
| 32 | + |
| 33 | + return ${operation.name}Outcome{InvokeServiceOperation(newRequest, Aws::Http::HttpMethod::HTTP_${operation.http.method})}; |
| 34 | + } |
| 35 | +#end |
4 | 36 |
|
| 37 | +#if($metadata.protocol == "ec2" || $metadata.protocol == "json" || $metadata.protocol == "query" || $metadata.protocol == "smithy-rpc-v2-cbor") |
5 | 38 | return ${operation.name}Outcome{InvokeServiceOperation(request, Aws::Http::HttpMethod::HTTP_${operation.http.method})}; |
6 | 39 | #elseif($metadata.protocol == "rest-json" || $metadata.protocol == "rest-xml") |
7 | | - #set($emitGenericOperation = true) |
8 | | - #parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientOperationRequestRequiredMemberValidate.vm") |
9 | | - |
10 | 40 | auto uriResolver = [&](Aws::Endpoint::ResolveEndpointOutcome& endpointResolutionOutcome) { |
11 | 41 | (void)endpointResolutionOutcome; |
12 | 42 | #parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/UriRequestPathSegments.vm") |
|
22 | 52 | return ${operation.name}Outcome{InvokeServiceOperation(request, uriResolver, Aws::Http::HttpMethod::HTTP_${operation.http.method})}; |
23 | 53 | #end |
24 | 54 | #end |
25 | | - |
26 | | -#set($emitGenericOperation = false) |
|
0 commit comments