fastly / fastly-py

A Fastly API client for Python
https://pypi.org/project/fastly/
MIT License
77 stars 59 forks source link

tls_configurations error on upload_tls_bulk_cert() #89

Open mechanicalgirl opened 1 year ago

mechanicalgirl commented 1 year ago

Version

fastly==1.3.0

What happened

I'm attempting to upload a TLS cert with the upload_tls_bulk_cert() method.

When I structure the request as per this example:

https://developer.fastly.com/reference/api/tls/platform/#upload-tls-bulk-cert

I get this error:

AttributeError: 'dict' object has no attribute 'tls_configurations'

The error looks like it's originating from the model_utils - I've got a stacktrace here:

https://gist.github.com/mechanicalgirl/9421a604b989b3ebb65aa3b44092b5bf

I've also tried structuring the request as per these docs:

https://github.com/fastly/fastly-py/blob/main/docs/TlsBulkCertificatesApi.md#upload_tls_bulk_cert

Where the error returned is this:

Exception when calling TlsBulkCertificatesApi->upload_tls_bulk_cert: (400)
Reason: Bad Request
HTTP response body: {"errors":[{"title":"Missing required attribute","detail":"param is missing or the value is empty: tls_configuration_ids"}]}

(My apologies, I did not save a stacktrace from this one.)

I've been able to get this working with a workaround that uses the request library and hits the api.fastly.com/tls/bulk/certificates endpoint directly.

I started with a Fastly support request - one of their engineers directed me to submit an issue here. Their ticket is https://support.fastly.com/hc/en-us/requests/610399 and may provide more detail. (There are some of my code examples in that ticket, although I don't think they'll be helpful as they mirror what's in your docs exactly, aside from the specific values being passed.)