1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #pragma once 7 8 #include <aws/s3/S3_EXPORTS.h> 9 10 #include <aws/core/client/AWSError.h> 11 #include <aws/core/utils/ARN.h> 12 #include <aws/s3/S3Errors.h> 13 14 namespace Aws 15 { 16 namespace Utils 17 { 18 template<typename R, typename E> class Outcome; 19 } 20 21 namespace S3 22 { 23 namespace ARNService 24 { 25 static const char S3[] = "s3"; 26 static const char S3_OUTPOSTS[] = "s3-outposts"; 27 static const char S3_OBJECT_LAMBDA[] = "s3-object-lambda"; 28 } 29 30 namespace ARNResourceType 31 { 32 static const char ACCESSPOINT[] = "accesspoint"; 33 static const char OUTPOST[] = "outpost"; 34 } 35 36 typedef Aws::Utils::Outcome<bool, Aws::Client::AWSError<S3Errors>> S3ARNOutcome; 37 38 class AWS_S3_API S3ARN : public Aws::Utils::ARN 39 { 40 public: 41 S3ARN(const Aws::String& arn); 42 GetResourceType()43 const Aws::String& GetResourceType() const { return m_resourceType; } GetResourceId()44 const Aws::String& GetResourceId() const { return m_resourceId; } GetSubResourceType()45 const Aws::String& GetSubResourceType() const { return m_subResourceType; } GetSubResourceId()46 const Aws::String& GetSubResourceId() const { return m_subResourceId; } GetResourceQualifier()47 const Aws::String& GetResourceQualifier() const { return m_resourceQualifier; } 48 49 // Check if S3ARN is valid. 50 S3ARNOutcome Validate() const; 51 // Check if S3ARN is valid, and especially, ARN region should match the region specified. 52 S3ARNOutcome Validate(const char* region) const; 53 54 private: 55 void ParseARNResource(); 56 57 Aws::String m_resourceType; 58 Aws::String m_resourceId; 59 Aws::String m_subResourceType; 60 Aws::String m_subResourceId; 61 Aws::String m_resourceQualifier; 62 }; 63 } 64 } 65