package s3shared
import (
)
const (
invalidARNErrorErrCode = "InvalidARNError"
configurationErrorErrCode = "ConfigurationError"
)
type InvalidARNError struct {
message string
resource arn.Resource
origErr error
}
func ( InvalidARNError) () string {
var string
if .resource != nil {
= "ARN: " + .resource.String()
}
:= invalidARNErrorErrCode + " : " + .message
if != "" {
= + "\n\t" +
}
return
}
func ( InvalidARNError) () error {
return .origErr
}
func ( arn.Resource, error) InvalidARNError {
return InvalidARNError{
message: "invalid ARN",
origErr: ,
resource: ,
}
}
func ( arn.Resource, error) InvalidARNError {
return InvalidARNError{
message: "resource ARN not supported for the target ARN partition",
origErr: ,
resource: ,
}
}
func ( arn.Resource, error) InvalidARNError {
return InvalidARNError{
message: "resource ARN not supported for FIPS region",
resource: ,
origErr: ,
}
}
type ConfigurationError struct {
message string
resource arn.Resource
clientPartitionID string
clientRegion string
origErr error
}
func ( ConfigurationError) () string {
:= fmt.Sprintf("ARN: %s, client partition: %s, client region: %s",
.resource, .clientPartitionID, .clientRegion)
:= configurationErrorErrCode + " : " + .message
if != "" {
= + "\n\t" +
}
return
}
func ( ConfigurationError) () error {
return .origErr
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client partition does not match provided ARN partition",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client region does not match provided ARN region",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "endpoint resolver failed to find an endpoint for the provided ARN region",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client configured for fips but cross-region resource ARN provided",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "use of ARN is not supported when client or request is configured for FIPS",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client configured for S3 Accelerate but is not supported with resource ARN",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client configured for FIPS with cross-region enabled but is supported with cross-region resource ARN",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}
func ( arn.Resource, , string, error) ConfigurationError {
return ConfigurationError{
message: "client configured for S3 Dual-stack but is not supported with resource ARN",
origErr: ,
resource: ,
clientPartitionID: ,
clientRegion: ,
}
}