Skip to content

Golang SDK for accessing different Akamai service APIs

License

Notifications You must be signed in to change notification settings

dstdfx/go-akamai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-akamai

Build Status Coverage Status

Golang SDK for accessing different Akamai service APIs. https://developer.akamai.com/api

Supported APIs:

Getting started

Installation

You can install go-akamai as a Go package:

go get github.com/dstdfx/go-akamai

Authentication

To work with Akamai APIs you need to create API client with specific access rules. More information here.

Usage example

// Example: cache invalidation for specific URLs.
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/dstdfx/go-akamai/akamai/ccu/v3"
	"github.com/dstdfx/go-akamai/akamai/ccu/v3/cache"
	"github.com/dstdfx/go-akamai/akamai/edgegrid"
)

func main(){
	// Fill it up with your credentials
	cfg := &edgegrid.Config{
		Host:         "<your-host>",
		ClientSecret: "<your-client-secret>",
		ClientToken:  "<your-client-token>",
		AccessToken:  "<your-access-token>",
		MaxBody:      131072,
	}

	client := v3.NewV3CCUClient(cfg)

	// Invalidate cache for specific URLs for production network.
	// Default context just for the sake of simplicity.
	resp, _, err := cache.InvalidateByURL(context.Background(),
		client,
		cache.ProductionNetwork,
		cache.URLs{
			Objects:[]string{
				"https://1136022d-e7a4-45ec-b60c-c41913eff6db.akamaized.net/example_video.mp4",
				"https://4136022d-e7a4-45ec-b60c-c41913eff6db.akamaized.net/example_video_4k.mp4",
			},
	})
	if err != nil {
            panic(err)
	}
	fmt.Printf("%+v\n", resp)
}

Contributing

Please read CONTRIBUTING.md for details.

License

This library is distributed under the MIT license found in the LICENSE file.

About

Golang SDK for accessing different Akamai service APIs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages