By Andre
I’m tryind to purge cache during my build process after uploading files to spaces cdn. But can’t do it with amazon sdk java version 2.
I have this article
https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-spaces-cdn-endpoints/
but can’t understand how to do it with amazon sdk. Should I user CloudFrontClient or something other?
What should I do, I wrote this code, but it fails? ( What shoud i use for distributionId?
def cfc = CloudFrontClient .builder() .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials .create( digitalOceanProps.getProperty(“Cdn_key”), digitalOceanProps.getProperty(“Cdn_secret”)))) .region(Region.of(“sfo2”)) .endpointOverride(URI.create(“https://sfo2.digitaloceanspaces.com”)) .build()
def paths = Paths.builder()
.items("/resources")
.quantity(1)
.build()
def invalidationBatch = InvalidationBatch.builder()
.paths(paths)
.build()
def invalidationRequest = CreateInvalidationRequest.builder()
.distributionId("cdn")
.invalidationBatch(invalidationBatch)
.build()
CreateInvalidationResponse ret = cfc.createInvalidation(
invalidationRequest
)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.