diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-02 12:50:27 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-02 12:50:27 +0300 |
commit | d0f80d5e60d77854f9d6262a59a7349e2b21f9d2 (patch) | |
tree | 01f1e033ce5519d96b7d6a83718221dcb8021eec /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source | |
parent | 26286f616cee657612a9d820be6da2cdbd4de0ef (diff) | |
download | ydb-d0f80d5e60d77854f9d6262a59a7349e2b21f9d2.tar.gz |
intermediate changes
ref:40ac71fae6ea311a73473cf4297ca93bf27559c3
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source')
17 files changed, 588 insertions, 40 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ARN.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ARN.cpp index c774bcd380..72bbbc8c7e 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ARN.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ARN.cpp @@ -61,10 +61,10 @@ namespace Aws ss << "Invalid partition in ARN: " << this->GetPartition() << ". Valid options: aws, aws-cn, and etc."; } // Validation on service. - else if (this->GetService() != "s3" && this->GetService() != "s3-outposts") + else if (this->GetService() != ARNService::S3 && this->GetService() != ARNService::S3_OUTPOSTS && this->GetService() != ARNService::S3_OBJECT_LAMBDA) { ss.str(""); - ss << "Invalid service in ARN: " << this->GetService() << ". Valid options: s3, s3-outposts"; + ss << "Invalid service in ARN: " << this->GetService() << ". Valid options: " << ARNService::S3 << ", " << ARNService::S3_OUTPOSTS << ", " << ARNService::S3_OBJECT_LAMBDA << "."; errorMessage = ss.str(); } // Validation on region. @@ -86,7 +86,7 @@ namespace Aws ss << "Invalid account ID in ARN: " << this->GetAccountId() << ". Account ID should be a RFC 3986 Host label."; errorMessage = ss.str(); } - // Validation on Access Point ARN: + // Validation on Access Point ARN and Object Lambda Access Point ARN: else if (this->GetResourceType() == ARNResourceType::ACCESSPOINT) { if (!Utils::IsValidDnsLabel(this->GetResourceId())) @@ -144,11 +144,11 @@ namespace Aws success = true; } } - // Neither Access Point ARN nor Outposts ARN. + // ARN with unknown resource type. else { ss.str(""); - ss << "Invalid resource type in ARN: " << this->GetResourceType() << ". Valid options: " << ARNResourceType::ACCESSPOINT << ", " << ARNResourceType::OUTPOST; + ss << "Invalid resource type in ARN: " << this->GetResourceType() << ". Valid options: " << ARNResourceType::ACCESSPOINT << ", " << ARNResourceType::OUTPOST << "."; errorMessage = ss.str(); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Client.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Client.cpp index ca21d88bb2..7f9eb2b4c6 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Client.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Client.cpp @@ -112,6 +112,7 @@ #include <aws/s3/model/SelectObjectContentRequest.h> #include <aws/s3/model/UploadPartRequest.h> #include <aws/s3/model/UploadPartCopyRequest.h> +#include <aws/s3/model/WriteGetObjectResponseRequest.h> using namespace Aws; using namespace Aws::Auth; @@ -178,6 +179,7 @@ void S3Client::init(const ClientConfiguration& config) m_useCustomEndpoint = true; OverrideEndpoint(config.endpointOverride); } + m_enableHostPrefixInjection = config.enableHostPrefixInjection; } void S3Client::OverrideEndpoint(const Aws::String& endpoint) @@ -3829,6 +3831,62 @@ void S3Client::UploadPartCopyAsyncHelper(const UploadPartCopyRequest& request, c handler(this, request, UploadPartCopy(request), context); } +WriteGetObjectResponseOutcome S3Client::WriteGetObjectResponse(const WriteGetObjectResponseRequest& request) const +{ + if (!request.RequestRouteHasBeenSet()) + { + AWS_LOGSTREAM_ERROR("WriteGetObjectResponse", "Required field: RequestRoute, is not set"); + return WriteGetObjectResponseOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [RequestRoute]", false)); + } + if (!request.RequestTokenHasBeenSet()) + { + AWS_LOGSTREAM_ERROR("WriteGetObjectResponse", "Required field: RequestToken, is not set"); + return WriteGetObjectResponseOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [RequestToken]", false)); + } + ComputeEndpointOutcome computeEndpointOutcome = ComputeEndpointStringWithServiceName("s3-object-lambda"); + if (!computeEndpointOutcome.IsSuccess()) + { + return WriteGetObjectResponseOutcome(computeEndpointOutcome.GetError()); + } + Aws::Http::URI uri = computeEndpointOutcome.GetResult().endpoint; + if (m_enableHostPrefixInjection) + { + if (request.GetRequestRoute().empty()) + { + AWS_LOGSTREAM_ERROR("WriteGetObjectResponse", "HostPrefix required field: RequestRoute, is empty"); + return WriteGetObjectResponseOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::INVALID_PARAMETER_VALUE, "INVALID_PARAMETER", "Host prefix field is empty", false)); + } + uri.SetAuthority("" + request.GetRequestRoute() + "." + uri.GetAuthority()); + if (!Aws::Utils::IsValidHost(uri.GetAuthority())) + { + AWS_LOGSTREAM_ERROR("WriteGetObjectResponse", "Invalid DNS host: " << uri.GetAuthority()); + return WriteGetObjectResponseOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::INVALID_PARAMETER_VALUE, "INVALID_PARAMETER", "Host is invalid", false)); + } + } + Aws::StringStream ss; + ss << "/WriteGetObjectResponse"; + uri.SetPath(uri.GetPath() + ss.str()); + return WriteGetObjectResponseOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER, computeEndpointOutcome.GetResult().signerRegion.c_str() /*signerRegionOverride*/, computeEndpointOutcome.GetResult().signerServiceName.c_str() /*signerServiceNameOverride*/)); +} + +WriteGetObjectResponseOutcomeCallable S3Client::WriteGetObjectResponseCallable(const WriteGetObjectResponseRequest& request) const +{ + auto task = Aws::MakeShared< std::packaged_task< WriteGetObjectResponseOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->WriteGetObjectResponse(request); } ); + auto packagedFunction = [task]() { (*task)(); }; + m_executor->Submit(packagedFunction); + return task->get_future(); +} + +void S3Client::WriteGetObjectResponseAsync(const WriteGetObjectResponseRequest& request, const WriteGetObjectResponseResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const +{ + m_executor->Submit( [this, request, handler, context](){ this->WriteGetObjectResponseAsyncHelper( request, handler, context ); } ); +} + +void S3Client::WriteGetObjectResponseAsyncHelper(const WriteGetObjectResponseRequest& request, const WriteGetObjectResponseResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const +{ + handler(this, request, WriteGetObjectResponse(request), context); +} + #include<aws/core/platform/Environment.h> @@ -4013,6 +4071,12 @@ Aws::String S3Client::GeneratePresignedUrlWithSSEC(const Aws::String& bucket, co ComputeEndpointOutcome S3Client::ComputeEndpointString(const Aws::String& bucketOrArn) const { + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } + Aws::StringStream ss; ss << m_scheme << "://"; Aws::String bucket = bucketOrArn; @@ -4021,12 +4085,6 @@ ComputeEndpointOutcome S3Client::ComputeEndpointString(const Aws::String& bucket if (arn) { - if (m_useCustomEndpoint) - { - return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", - "Custom endpoint is not compatible with Access Point ARN or Outposts ARN in Bucket field.", false)); - } - if (!m_useVirtualAddressing) { return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", @@ -4039,9 +4097,19 @@ ComputeEndpointOutcome S3Client::ComputeEndpointString(const Aws::String& bucket return ComputeEndpointOutcome(s3ArnOutcome.GetError()); } signerRegion = m_useArnRegion ? arn.GetRegion() : signerRegion; - if (arn.GetResourceType() == ARNResourceType::ACCESSPOINT) + if (arn.GetService() == ARNService::S3_OBJECT_LAMBDA) { - ss << S3Endpoint::ForAccessPointArn(arn, m_useArnRegion ? "" : m_region, m_useDualStack); + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", + "S3 Object Lambda Access Point ARNs do not support dualstack right now.", false)); + } + ss << S3Endpoint::ForObjectLambdaAccessPointArn(arn, m_useArnRegion ? "" : m_region, m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, ARNService::S3_OBJECT_LAMBDA)); + } + else if (arn.GetResourceType() == ARNResourceType::ACCESSPOINT) + { + ss << S3Endpoint::ForAccessPointArn(arn, m_useArnRegion ? "" : m_region, m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, SERVICE_NAME)); } else if (arn.GetResourceType() == ARNResourceType::OUTPOST) @@ -4051,7 +4119,7 @@ ComputeEndpointOutcome S3Client::ComputeEndpointString(const Aws::String& bucket return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", "Outposts Access Points do not support dualstack right now.", false)); } - ss << S3Endpoint::ForOutpostsArn(arn, m_useArnRegion ? "" : m_region); + ss << S3Endpoint::ForOutpostsArn(arn, m_useArnRegion ? "" : m_region, m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, "s3-outposts")); } } @@ -4074,11 +4142,51 @@ ComputeEndpointOutcome S3Client::ComputeEndpointString(const Aws::String& bucket ComputeEndpointOutcome S3Client::ComputeEndpointString() const { + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } Aws::StringStream ss; ss << m_scheme << "://" << m_baseUri; return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), SERVICE_NAME)); } +ComputeEndpointOutcome S3Client::ComputeEndpointStringWithServiceName(const Aws::String& serviceNameOverride) const +{ + if (serviceNameOverride.empty()) + { + return ComputeEndpointString(); + } + + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } + + Aws::StringStream ss; + ss << m_scheme << "://"; + if (m_useCustomEndpoint) + { + ss << m_baseUri; + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), serviceNameOverride)); + } + else + { + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<S3Errors>(S3Errors::VALIDATION, "VALIDATION", + "S3 Object Lambda endpoints do not support dualstack right now.", false)); + } + else + { + ss << S3Endpoint::ForRegion(m_region, m_useDualStack, true, serviceNameOverride); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), serviceNameOverride)); + } + } +} + bool S3Client::MultipartUploadSupported() const { return true; diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Endpoint.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Endpoint.cpp index c81556085f..d684a11a44 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Endpoint.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Endpoint.cpp @@ -24,15 +24,23 @@ namespace S3Endpoint static const int FIPS_US_GOV_WEST_1_HASH = Aws::Utils::HashingUtils::HashString("fips-us-gov-west-1"); static const int US_GOV_WEST_1_HASH = Aws::Utils::HashingUtils::HashString("us-gov-west-1"); static const int US_GOV_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-gov-east-1"); + static const int S3_EXTERNAL_1_HASH = Aws::Utils::HashingUtils::HashString("s3-external-1"); static const int US_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-east-1"); static const int AWS_GLOBAL_HASH = Aws::Utils::HashingUtils::HashString("aws-global"); - Aws::String ForAccessPointArn(const S3ARN& arn, const Aws::String& regionNameOverride, bool useDualStack) + Aws::String ForAccessPointArn(const S3ARN& arn, const Aws::String& regionNameOverride, bool useDualStack, const Aws::String& endpointOverride) { + Aws::StringStream ss; + + if (!endpointOverride.empty()) + { + ss << arn.GetResourceId() << "-" << arn.GetAccountId() << "." << endpointOverride; + return ss.str(); + } + const Aws::String& region = regionNameOverride.empty() ? arn.GetRegion() : regionNameOverride; auto hash = Aws::Utils::HashingUtils::HashString(region.c_str()); - Aws::StringStream ss; ss << arn.GetResourceId() << "-" << arn.GetAccountId() << ".s3-accesspoint."; if (useDualStack) { @@ -48,14 +56,59 @@ namespace S3Endpoint return ss.str(); } - Aws::String ForOutpostsArn(const S3ARN& arn, const Aws::String& regionNameOverride) + Aws::String ForOutpostsArn(const S3ARN& arn, const Aws::String& regionNameOverride, bool useDualStack, const Aws::String& endpointOverride) { + AWS_UNREFERENCED_PARAM(useDualStack); + assert(!useDualStack); + Aws::StringStream ss; + + if (!endpointOverride.empty()) + { + ss << arn.GetSubResourceId() << "-" << arn.GetAccountId() << "." << arn.GetResourceId() << "." << endpointOverride; + return ss.str(); + } + const Aws::String& region = regionNameOverride.empty() ? arn.GetRegion() : regionNameOverride; auto hash = Aws::Utils::HashingUtils::HashString(region.c_str()); + ss << arn.GetSubResourceId() << "-" << arn.GetAccountId() << "." << arn.GetResourceId() << "." << ARNService::S3_OUTPOSTS << "." << region << "." << "amazonaws.com"; + + if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH) + { + ss << ".cn"; + } + + return ss.str(); + } + + Aws::String ForObjectLambdaAccessPointArn(const S3ARN& arn, const Aws::String& regionNameOverride, bool useDualStack, const Aws::String& endpointOverride) + { + AWS_UNREFERENCED_PARAM(useDualStack); + assert(!useDualStack); Aws::StringStream ss; - ss << arn.GetSubResourceId() << "-" << arn.GetAccountId() << "." << arn.GetResourceId() << ".s3-outposts." << region << "." << "amazonaws.com"; + if (!endpointOverride.empty()) + { + ss << arn.GetResourceId() << "-" << arn.GetAccountId() << "." << endpointOverride; + return ss.str(); + } + + Aws::String region = regionNameOverride.empty() ? arn.GetRegion() : regionNameOverride; + Aws::String fipsSuffix = ""; + if (region.size() >= 5 && region.compare(0, 5, "fips-") == 0) + { + region = region.substr(5); + fipsSuffix = "-fips"; + } + else if (region.size() >= 5 && region.compare(region.size() - 5, 5, "-fips") == 0) + { + region = region.substr(0, region.size() - 5); + fipsSuffix = "-fips"; + } + + ss << arn.GetResourceId() << "-" << arn.GetAccountId() << "." << ARNService::S3_OBJECT_LAMBDA << fipsSuffix << "." << region << "." << "amazonaws.com"; + + auto hash = Aws::Utils::HashingUtils::HashString(region.c_str()); if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH) { ss << ".cn"; @@ -64,10 +117,41 @@ namespace S3Endpoint return ss.str(); } - Aws::String ForRegion(const Aws::String& regionName, bool useDualStack, bool USEast1UseRegionalEndpoint) + Aws::String ForRegion(const Aws::String& regionName, bool useDualStack, bool USEast1UseRegionalEndpoint, const Aws::String& serviceName) { auto hash = Aws::Utils::HashingUtils::HashString(regionName.c_str()); + if (!serviceName.empty()) + { + assert(!useDualStack); + + Aws::StringStream ss; + ss << serviceName; + + if (regionName.size() >= 5 && regionName.compare(0, 5, "fips-") == 0) + { + ss << "-fips." << regionName.substr(5); + } + else if (regionName.size() >= 5 && regionName.compare(regionName.size() - 5, 5, "-fips") == 0) + { + ss << "-fips." << regionName.substr(0, regionName.size() - 5); + } + else if (hash == AWS_GLOBAL_HASH || hash == S3_EXTERNAL_1_HASH) + { + ss << "." << Aws::Region::US_EAST_1; + } + else + { + ss << "." << regionName; + } + ss << ".amazonaws.com"; + if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH) + { + ss << ".cn"; + } + return ss.str(); + } + if(!useDualStack) { if(hash == FIPS_US_GOV_WEST_1_HASH) @@ -86,6 +170,10 @@ namespace S3Endpoint { return "s3.amazonaws.com"; } + if (hash == S3_EXTERNAL_1_HASH) + { + return "s3-external-1.amazonaws.com"; + } if(hash == US_EAST_1_HASH) { if (USEast1UseRegionalEndpoint) diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CORSRule.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CORSRule.cpp index dd1b40db2f..7a622df798 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CORSRule.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CORSRule.cpp @@ -21,6 +21,7 @@ namespace Model { CORSRule::CORSRule() : + m_iDHasBeenSet(false), m_allowedHeadersHasBeenSet(false), m_allowedMethodsHasBeenSet(false), m_allowedOriginsHasBeenSet(false), @@ -31,6 +32,7 @@ CORSRule::CORSRule() : } CORSRule::CORSRule(const XmlNode& xmlNode) : + m_iDHasBeenSet(false), m_allowedHeadersHasBeenSet(false), m_allowedMethodsHasBeenSet(false), m_allowedOriginsHasBeenSet(false), @@ -47,6 +49,12 @@ CORSRule& CORSRule::operator =(const XmlNode& xmlNode) if(!resultNode.IsNull()) { + XmlNode iDNode = resultNode.FirstChild("ID"); + if(!iDNode.IsNull()) + { + m_iD = Aws::Utils::Xml::DecodeEscapedXmlText(iDNode.GetText()); + m_iDHasBeenSet = true; + } XmlNode allowedHeadersNode = resultNode.FirstChild("AllowedHeader"); if(!allowedHeadersNode.IsNull()) { @@ -109,6 +117,12 @@ CORSRule& CORSRule::operator =(const XmlNode& xmlNode) void CORSRule::AddToNode(XmlNode& parentNode) const { Aws::StringStream ss; + if(m_iDHasBeenSet) + { + XmlNode iDNode = parentNode.CreateChildElement("ID"); + iDNode.SetText(m_iD); + } + if(m_allowedHeadersHasBeenSet) { for(const auto& item : m_allowedHeaders) diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CopyObjectRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CopyObjectRequest.cpp index bd9f656890..94493cfdcf 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CopyObjectRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CopyObjectRequest.cpp @@ -279,8 +279,8 @@ Aws::Http::HeaderValueCollection CopyObjectRequest::GetRequestSpecificHeaders() if(m_bucketKeyEnabledHasBeenSet) { - ss << m_bucketKeyEnabled; - headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); + ss << std::boolalpha << m_bucketKeyEnabled; + headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); ss.str(""); } @@ -324,7 +324,7 @@ Aws::Http::HeaderValueCollection CopyObjectRequest::GetRequestSpecificHeaders() if(m_objectLockRetainUntilDateHasBeenSet) { - headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::RFC822)); + headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::ISO_8601)); } if(m_objectLockLegalHoldStatusHasBeenSet) diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateBucketRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateBucketRequest.cpp index 0cd50dbf6d..0bc3641a33 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateBucketRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateBucketRequest.cpp @@ -116,8 +116,8 @@ Aws::Http::HeaderValueCollection CreateBucketRequest::GetRequestSpecificHeaders( if(m_objectLockEnabledForBucketHasBeenSet) { - ss << m_objectLockEnabledForBucket; - headers.emplace("x-amz-bucket-object-lock-enabled", ss.str()); + ss << std::boolalpha << m_objectLockEnabledForBucket; + headers.emplace("x-amz-bucket-object-lock-enabled", ss.str()); ss.str(""); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateMultipartUploadRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateMultipartUploadRequest.cpp index 2347045761..73a88bf2dc 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateMultipartUploadRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/CreateMultipartUploadRequest.cpp @@ -225,8 +225,8 @@ Aws::Http::HeaderValueCollection CreateMultipartUploadRequest::GetRequestSpecifi if(m_bucketKeyEnabledHasBeenSet) { - ss << m_bucketKeyEnabled; - headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); + ss << std::boolalpha << m_bucketKeyEnabled; + headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); ss.str(""); } @@ -249,7 +249,7 @@ Aws::Http::HeaderValueCollection CreateMultipartUploadRequest::GetRequestSpecifi if(m_objectLockRetainUntilDateHasBeenSet) { - headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::RFC822)); + headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::ISO_8601)); } if(m_objectLockLegalHoldStatusHasBeenSet) diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectRequest.cpp index 08da25d567..6bd83e7cbe 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectRequest.cpp @@ -82,8 +82,8 @@ Aws::Http::HeaderValueCollection DeleteObjectRequest::GetRequestSpecificHeaders( if(m_bypassGovernanceRetentionHasBeenSet) { - ss << m_bypassGovernanceRetention; - headers.emplace("x-amz-bypass-governance-retention", ss.str()); + ss << std::boolalpha << m_bypassGovernanceRetention; + headers.emplace("x-amz-bypass-governance-retention", ss.str()); ss.str(""); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectsRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectsRequest.cpp index 42118cc4b5..3f7759ca0a 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectsRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/DeleteObjectsRequest.cpp @@ -85,8 +85,8 @@ Aws::Http::HeaderValueCollection DeleteObjectsRequest::GetRequestSpecificHeaders if(m_bypassGovernanceRetentionHasBeenSet) { - ss << m_bypassGovernanceRetention; - headers.emplace("x-amz-bypass-governance-retention", ss.str()); + ss << std::boolalpha << m_bypassGovernanceRetention; + headers.emplace("x-amz-bypass-governance-retention", ss.str()); ss.str(""); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectResult.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectResult.cpp index 8c20face8e..f0959a570a 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectResult.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectResult.cpp @@ -319,7 +319,7 @@ GetObjectResult& GetObjectResult::operator =(Aws::AmazonWebServiceResult<Respons const auto& objectLockRetainUntilDateIter = headers.find("x-amz-object-lock-retain-until-date"); if(objectLockRetainUntilDateIter != headers.end()) { - m_objectLockRetainUntilDate = DateTime(objectLockRetainUntilDateIter->second, DateFormat::RFC822); + m_objectLockRetainUntilDate = DateTime(objectLockRetainUntilDateIter->second, DateFormat::ISO_8601); } const auto& objectLockLegalHoldStatusIter = headers.find("x-amz-object-lock-legal-hold"); diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectTaggingRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectTaggingRequest.cpp index 447a1c4041..fb9a5d55e4 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectTaggingRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/GetObjectTaggingRequest.cpp @@ -21,6 +21,8 @@ GetObjectTaggingRequest::GetObjectTaggingRequest() : m_keyHasBeenSet(false), m_versionIdHasBeenSet(false), m_expectedBucketOwnerHasBeenSet(false), + m_requestPayer(RequestPayer::NOT_SET), + m_requestPayerHasBeenSet(false), m_customizedAccessLogTagHasBeenSet(false) { } @@ -70,5 +72,10 @@ Aws::Http::HeaderValueCollection GetObjectTaggingRequest::GetRequestSpecificHead ss.str(""); } + if(m_requestPayerHasBeenSet) + { + headers.emplace("x-amz-request-payer", RequestPayerMapper::GetNameForRequestPayer(m_requestPayer)); + } + return headers; } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/HeadObjectResult.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/HeadObjectResult.cpp index ce0305dcaf..f498d56aab 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/HeadObjectResult.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/HeadObjectResult.cpp @@ -235,7 +235,7 @@ HeadObjectResult& HeadObjectResult::operator =(const Aws::AmazonWebServiceResult const auto& objectLockRetainUntilDateIter = headers.find("x-amz-object-lock-retain-until-date"); if(objectLockRetainUntilDateIter != headers.end()) { - m_objectLockRetainUntilDate = DateTime(objectLockRetainUntilDateIter->second, DateFormat::RFC822); + m_objectLockRetainUntilDate = DateTime(objectLockRetainUntilDateIter->second, DateFormat::ISO_8601); } const auto& objectLockLegalHoldStatusIter = headers.find("x-amz-object-lock-legal-hold"); diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutBucketPolicyRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutBucketPolicyRequest.cpp index ce52fa7cd8..d7fc444c2d 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutBucketPolicyRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutBucketPolicyRequest.cpp @@ -62,8 +62,8 @@ Aws::Http::HeaderValueCollection PutBucketPolicyRequest::GetRequestSpecificHeade if(m_confirmRemoveSelfBucketAccessHasBeenSet) { - ss << m_confirmRemoveSelfBucketAccess; - headers.emplace("x-amz-confirm-remove-self-bucket-access", ss.str()); + ss << std::boolalpha << m_confirmRemoveSelfBucketAccess; + headers.emplace("x-amz-confirm-remove-self-bucket-access", ss.str()); ss.str(""); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRequest.cpp index 1a3f34b3e8..18cdc3866f 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRequest.cpp @@ -231,8 +231,8 @@ Aws::Http::HeaderValueCollection PutObjectRequest::GetRequestSpecificHeaders() c if(m_bucketKeyEnabledHasBeenSet) { - ss << m_bucketKeyEnabled; - headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); + ss << std::boolalpha << m_bucketKeyEnabled; + headers.emplace("x-amz-server-side-encryption-bucket-key-enabled", ss.str()); ss.str(""); } @@ -255,7 +255,7 @@ Aws::Http::HeaderValueCollection PutObjectRequest::GetRequestSpecificHeaders() c if(m_objectLockRetainUntilDateHasBeenSet) { - headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::RFC822)); + headers.emplace("x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::ISO_8601)); } if(m_objectLockLegalHoldStatusHasBeenSet) diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRetentionRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRetentionRequest.cpp index 1c0101a0c4..779ac68bd3 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRetentionRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectRetentionRequest.cpp @@ -87,8 +87,8 @@ Aws::Http::HeaderValueCollection PutObjectRetentionRequest::GetRequestSpecificHe if(m_bypassGovernanceRetentionHasBeenSet) { - ss << m_bypassGovernanceRetention; - headers.emplace("x-amz-bypass-governance-retention", ss.str()); + ss << std::boolalpha << m_bypassGovernanceRetention; + headers.emplace("x-amz-bypass-governance-retention", ss.str()); ss.str(""); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectTaggingRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectTaggingRequest.cpp index d93c0108ea..612eb0eb8e 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectTaggingRequest.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/PutObjectTaggingRequest.cpp @@ -23,6 +23,8 @@ PutObjectTaggingRequest::PutObjectTaggingRequest() : m_contentMD5HasBeenSet(false), m_taggingHasBeenSet(false), m_expectedBucketOwnerHasBeenSet(false), + m_requestPayer(RequestPayer::NOT_SET), + m_requestPayerHasBeenSet(false), m_customizedAccessLogTagHasBeenSet(false) { } @@ -90,5 +92,10 @@ Aws::Http::HeaderValueCollection PutObjectTaggingRequest::GetRequestSpecificHead ss.str(""); } + if(m_requestPayerHasBeenSet) + { + headers.emplace("x-amz-request-payer", RequestPayerMapper::GetNameForRequestPayer(m_requestPayer)); + } + return headers; } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/WriteGetObjectResponseRequest.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/WriteGetObjectResponseRequest.cpp new file mode 100644 index 0000000000..49893d5823 --- /dev/null +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/model/WriteGetObjectResponseRequest.cpp @@ -0,0 +1,324 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include <aws/s3/model/WriteGetObjectResponseRequest.h> +#include <aws/core/AmazonWebServiceResult.h> +#include <aws/core/http/URI.h> +#include <aws/core/utils/memory/stl/AWSStringStream.h> +#include <aws/core/utils/HashingUtils.h> + +#include <utility> + +using namespace Aws::S3::Model; +using namespace Aws::Utils::Stream; +using namespace Aws::Utils; +using namespace Aws::Http; +using namespace Aws; + +WriteGetObjectResponseRequest::WriteGetObjectResponseRequest() : + m_requestRouteHasBeenSet(false), + m_requestTokenHasBeenSet(false), + m_statusCode(0), + m_statusCodeHasBeenSet(false), + m_errorCodeHasBeenSet(false), + m_errorMessageHasBeenSet(false), + m_acceptRangesHasBeenSet(false), + m_cacheControlHasBeenSet(false), + m_contentDispositionHasBeenSet(false), + m_contentEncodingHasBeenSet(false), + m_contentLanguageHasBeenSet(false), + m_contentLength(0), + m_contentLengthHasBeenSet(false), + m_contentRangeHasBeenSet(false), + m_deleteMarker(false), + m_deleteMarkerHasBeenSet(false), + m_eTagHasBeenSet(false), + m_expiresHasBeenSet(false), + m_expirationHasBeenSet(false), + m_lastModifiedHasBeenSet(false), + m_missingMeta(0), + m_missingMetaHasBeenSet(false), + m_metadataHasBeenSet(false), + m_objectLockMode(ObjectLockMode::NOT_SET), + m_objectLockModeHasBeenSet(false), + m_objectLockLegalHoldStatus(ObjectLockLegalHoldStatus::NOT_SET), + m_objectLockLegalHoldStatusHasBeenSet(false), + m_objectLockRetainUntilDateHasBeenSet(false), + m_partsCount(0), + m_partsCountHasBeenSet(false), + m_replicationStatus(ReplicationStatus::NOT_SET), + m_replicationStatusHasBeenSet(false), + m_requestCharged(RequestCharged::NOT_SET), + m_requestChargedHasBeenSet(false), + m_restoreHasBeenSet(false), + m_serverSideEncryption(ServerSideEncryption::NOT_SET), + m_serverSideEncryptionHasBeenSet(false), + m_sSECustomerAlgorithmHasBeenSet(false), + m_sSEKMSKeyIdHasBeenSet(false), + m_sSECustomerKeyMD5HasBeenSet(false), + m_storageClass(StorageClass::NOT_SET), + m_storageClassHasBeenSet(false), + m_tagCount(0), + m_tagCountHasBeenSet(false), + m_versionIdHasBeenSet(false), + m_bucketKeyEnabled(false), + m_bucketKeyEnabledHasBeenSet(false), + m_customizedAccessLogTagHasBeenSet(false) +{ +} + + +void WriteGetObjectResponseRequest::AddQueryStringParameters(URI& uri) const +{ + Aws::StringStream ss; + if(!m_customizedAccessLogTag.empty()) + { + // only accept customized LogTag which starts with "x-" + Aws::Map<Aws::String, Aws::String> collectedLogTags; + for(const auto& entry: m_customizedAccessLogTag) + { + if (!entry.first.empty() && !entry.second.empty() && entry.first.substr(0, 2) == "x-") + { + collectedLogTags.emplace(entry.first, entry.second); + } + } + + if (!collectedLogTags.empty()) + { + uri.AddQueryStringParameter(collectedLogTags); + } + } +} + +Aws::Http::HeaderValueCollection WriteGetObjectResponseRequest::GetRequestSpecificHeaders() const +{ + Aws::Http::HeaderValueCollection headers; + Aws::StringStream ss; + if(m_requestRouteHasBeenSet) + { + ss << m_requestRoute; + headers.emplace("x-amz-request-route", ss.str()); + ss.str(""); + } + + if(m_requestTokenHasBeenSet) + { + ss << m_requestToken; + headers.emplace("x-amz-request-token", ss.str()); + ss.str(""); + } + + if(m_statusCodeHasBeenSet) + { + ss << m_statusCode; + headers.emplace("x-amz-fwd-status", ss.str()); + ss.str(""); + } + + if(m_errorCodeHasBeenSet) + { + ss << m_errorCode; + headers.emplace("x-amz-fwd-error-code", ss.str()); + ss.str(""); + } + + if(m_errorMessageHasBeenSet) + { + ss << m_errorMessage; + headers.emplace("x-amz-fwd-error-message", ss.str()); + ss.str(""); + } + + if(m_acceptRangesHasBeenSet) + { + ss << m_acceptRanges; + headers.emplace("x-amz-fwd-header-accept-ranges", ss.str()); + ss.str(""); + } + + if(m_cacheControlHasBeenSet) + { + ss << m_cacheControl; + headers.emplace("x-amz-fwd-header-cache-control", ss.str()); + ss.str(""); + } + + if(m_contentDispositionHasBeenSet) + { + ss << m_contentDisposition; + headers.emplace("x-amz-fwd-header-content-disposition", ss.str()); + ss.str(""); + } + + if(m_contentEncodingHasBeenSet) + { + ss << m_contentEncoding; + headers.emplace("x-amz-fwd-header-content-encoding", ss.str()); + ss.str(""); + } + + if(m_contentLanguageHasBeenSet) + { + ss << m_contentLanguage; + headers.emplace("x-amz-fwd-header-content-language", ss.str()); + ss.str(""); + } + + if(m_contentLengthHasBeenSet) + { + ss << m_contentLength; + headers.emplace("content-length", ss.str()); + ss.str(""); + } + + if(m_contentRangeHasBeenSet) + { + ss << m_contentRange; + headers.emplace("x-amz-fwd-header-content-range", ss.str()); + ss.str(""); + } + + if(m_deleteMarkerHasBeenSet) + { + ss << std::boolalpha << m_deleteMarker; + headers.emplace("x-amz-fwd-header-x-amz-delete-marker", ss.str()); + ss.str(""); + } + + if(m_eTagHasBeenSet) + { + ss << m_eTag; + headers.emplace("x-amz-fwd-header-etag", ss.str()); + ss.str(""); + } + + if(m_expiresHasBeenSet) + { + headers.emplace("x-amz-fwd-header-expires", m_expires.ToGmtString(DateFormat::RFC822)); + } + + if(m_expirationHasBeenSet) + { + ss << m_expiration; + headers.emplace("x-amz-fwd-header-x-amz-expiration", ss.str()); + ss.str(""); + } + + if(m_lastModifiedHasBeenSet) + { + headers.emplace("x-amz-fwd-header-last-modified", m_lastModified.ToGmtString(DateFormat::RFC822)); + } + + if(m_missingMetaHasBeenSet) + { + ss << m_missingMeta; + headers.emplace("x-amz-fwd-header-x-amz-missing-meta", ss.str()); + ss.str(""); + } + + if(m_metadataHasBeenSet) + { + for(const auto& item : m_metadata) + { + ss << "x-amz-meta-" << item.first; + headers.emplace(ss.str(), item.second); + ss.str(""); + } + } + + if(m_objectLockModeHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-object-lock-mode", ObjectLockModeMapper::GetNameForObjectLockMode(m_objectLockMode)); + } + + if(m_objectLockLegalHoldStatusHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-object-lock-legal-hold", ObjectLockLegalHoldStatusMapper::GetNameForObjectLockLegalHoldStatus(m_objectLockLegalHoldStatus)); + } + + if(m_objectLockRetainUntilDateHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-object-lock-retain-until-date", m_objectLockRetainUntilDate.ToGmtString(DateFormat::ISO_8601)); + } + + if(m_partsCountHasBeenSet) + { + ss << m_partsCount; + headers.emplace("x-amz-fwd-header-x-amz-mp-parts-count", ss.str()); + ss.str(""); + } + + if(m_replicationStatusHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-replication-status", ReplicationStatusMapper::GetNameForReplicationStatus(m_replicationStatus)); + } + + if(m_requestChargedHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-request-charged", RequestChargedMapper::GetNameForRequestCharged(m_requestCharged)); + } + + if(m_restoreHasBeenSet) + { + ss << m_restore; + headers.emplace("x-amz-fwd-header-x-amz-restore", ss.str()); + ss.str(""); + } + + if(m_serverSideEncryptionHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-server-side-encryption", ServerSideEncryptionMapper::GetNameForServerSideEncryption(m_serverSideEncryption)); + } + + if(m_sSECustomerAlgorithmHasBeenSet) + { + ss << m_sSECustomerAlgorithm; + headers.emplace("x-amz-fwd-header-x-amz-server-side-encryption-customer-algorithm", ss.str()); + ss.str(""); + } + + if(m_sSEKMSKeyIdHasBeenSet) + { + ss << m_sSEKMSKeyId; + headers.emplace("x-amz-fwd-header-x-amz-server-side-encryption-aws-kms-key-id", ss.str()); + ss.str(""); + } + + if(m_sSECustomerKeyMD5HasBeenSet) + { + ss << m_sSECustomerKeyMD5; + headers.emplace("x-amz-fwd-header-x-amz-server-side-encryption-customer-key-md5", ss.str()); + ss.str(""); + } + + if(m_storageClassHasBeenSet) + { + headers.emplace("x-amz-fwd-header-x-amz-storage-class", StorageClassMapper::GetNameForStorageClass(m_storageClass)); + } + + if(m_tagCountHasBeenSet) + { + ss << m_tagCount; + headers.emplace("x-amz-fwd-header-x-amz-tagging-count", ss.str()); + ss.str(""); + } + + if(m_versionIdHasBeenSet) + { + ss << m_versionId; + headers.emplace("x-amz-fwd-header-x-amz-version-id", ss.str()); + ss.str(""); + } + + if(m_bucketKeyEnabledHasBeenSet) + { + ss << std::boolalpha << m_bucketKeyEnabled; + headers.emplace("x-amz-fwd-header-x-amz-server-side-encryption-bucket-key-enabled", ss.str()); + ss.str(""); + } + + return headers; + +} |