aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 13 forks source link

S3 types.ReplicationStatusComplete is invalid #524

Open Nuru opened 1 year ago

Nuru commented 1 year ago

Describe the bug

The S3 service defines the enum ReplicationStatusComplete https://github.com/aws/aws-sdk-go-v2/blob/b83b3053dda120e4687168a211cf5eca4c071bfe/service/s3/types/enums.go#L983

The value actually returned by S3 is "COMPLETED" not "COMPLETE". See Replication Status and many other documents.

Expected Behavior

All enums match valid responses.

Current Behavior

There is no enum to match the resulting replication status when an object is replicated. No response will ever match types.ReplicationStatusComplete

Reproduction Steps

if replicaStatus, err := s3Client.HeadObject(context.TODO(), replicaStatusRequest); err == nil {  
  if replicaStatus.ReplicationStatus != types.ReplicationStatusComplete {
    log.Printf("Replication Status is %v", replicaStatus.ReplicationStatus)
  }
}

Possible Solution

The enum should be named ReplicationStatusCompleted and have a value of "COMPLETED".

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

1.27.1

Compiler and Version used

go version go1.20.2 darwin/amd64

Operating System and version

macOS 12.6.4

RanVaknin commented 1 year ago

Hi @Nuru ,

Thanks for reporting the issue. I can verify that this is an issue. In the meantime you can do a string comparison since this is a string enum:

if replicaStatus, err := s3Client.HeadObject(context.TODO(), replicaStatusRequest); err == nil {  
  if replicaStatus.ReplicationStatus != "COMPLETE" {
    log.Printf("Replication Status is %v", replicaStatus.ReplicationStatus)
  }
}

I'll upstream this to the service team to either update their model or to return the correct value from their backend. Thanks, Ran~

P86847278