package arn

import (
	
	

	
)

var supportedServiceARN = []string{
	"s3",
	"s3-outposts",
	"s3-object-lambda",
}

func ( string) bool {
	for ,  := range supportedServiceARN {
		if  ==  {
			return true
		}
	}
	return false
}

// Resource provides the interfaces abstracting ARNs of specific resource
// types.
type Resource interface {
	GetARN() arn.ARN
	String() string
}

// ResourceParser provides the function for parsing an ARN's resource
// component into a typed resource.
type ResourceParser func(arn.ARN) (Resource, error)

// ParseResource parses an AWS ARN into a typed resource for the S3 API.
func ( arn.ARN,  ResourceParser) ( Resource,  error) {
	if len(.Partition) == 0 {
		return nil, InvalidARNError{ARN: , Reason: "partition not set"}
	}

	if !isSupportedServiceARN(.Service) {
		return nil, InvalidARNError{ARN: , Reason: "service is not supported"}
	}

	if len(.Resource) == 0 {
		return nil, InvalidARNError{ARN: , Reason: "resource not set"}
	}

	return ()
}

// SplitResource splits the resource components by the ARN resource delimiters.
func ( string) []string {
	var  []string
	var  int

	for  <= len() {
		 := strings.IndexAny([:], "/:")
		if  < 0 {
			 = append(, [:])
			break
		}
		 = append(, [:+])
		 +=  + 1
	}

	return 
}

// IsARN returns whether the given string is an ARN
func ( string) bool {
	return arn.IsARN()
}

// InvalidARNError provides the error for an invalid ARN error.
type InvalidARNError struct {
	ARN    arn.ARN
	Reason string
}

// Error returns a string denoting the occurred InvalidARNError
func ( InvalidARNError) () string {
	return fmt.Sprintf("invalid Amazon %s ARN, %s, %s", .ARN.Service, .Reason, .ARN.String())
}