soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
875 stars 83 forks source link

Wrong KeyAlgorithm for ACM Service #723

Closed portellaa closed 1 month ago

portellaa commented 1 month ago

Describe the bug While trying to use the lib to describe a certificate, i received an error saying that the value for KeyAlgorithm couldn't be decoded

Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "Certificate", intValue: nil), CodingKeys(stringValue: "KeyAlgorithm", intValue: nil)], debugDescription: "Cannot initialize KeyAlgorithm from invalid String value RSA-2048", underlyingError: nil))

To Reproduce Steps to reproduce the behavior:

  1. Create a certificate or use an existing one
  2. Use SotoACM to describe that certificate
// Create an AWS client
let awsClient = AWSClient()

// Create an ACM client
let acm = ACM(client: awsClient, region: <your region>)

// Describe the certificate to get its details
let request = ACM.DescribeCertificateRequest(certificateArn: 'certificate ARN')
let response = try await acm.describeCertificate(request)

// Extract the DomainValidationOptions
guard let domainValidationOptions = response.certificate?.domainValidationOptions else {
    print("No domain validation options found")
    return
}

Expected behavior This should retrieve the description of the certificate without any problem.

Setup (please complete the following information):

portellaa commented 1 month ago

I was trying to open a PR for this, but just notice that the models come from the Go SDK.

Probably the best way for this is a custom decoder that checks for _ or - ? But it sounds 🔨 😕

adam-fowler commented 1 month ago

This is frustrating. Both documentation and models report the values use an _. The code generator has a way to patch invalid model files so I can add a patch to fix this.

adam-fowler commented 1 month ago

This is now fixed on main. And will come out with the next release