{"id":20331215,"url":"https://github.com/comcast/go-edgegrid","last_synced_at":"2025-04-11T21:07:51.612Z","repository":{"id":57508290,"uuid":"52390524","full_name":"Comcast/go-edgegrid","owner":"Comcast","description":"A Golang Akamai API client and Akamai OPEN EdgeGrid Authentication scheme authentication handler.","archived":false,"fork":false,"pushed_at":"2018-06-01T19:50:11.000Z","size":53,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T21:07:46.659Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Comcast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-23T20:48:14.000Z","updated_at":"2021-06-15T17:34:10.000Z","dependencies_parsed_at":"2022-08-29T22:41:48.742Z","dependency_job_id":null,"html_url":"https://github.com/Comcast/go-edgegrid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fgo-edgegrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fgo-edgegrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fgo-edgegrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fgo-edgegrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Comcast","download_url":"https://codeload.github.com/Comcast/go-edgegrid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480434,"owners_count":21110937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T20:19:16.270Z","updated_at":"2025-04-11T21:07:51.580Z","avatar_url":"https://github.com/Comcast.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edgegrid\n\n[![Build Status](https://travis-ci.org/Comcast/go-edgegrid.svg?branch=master)](https://travis-ci.org/Comcast/go-edgegrid)\n\nA Golang [Akamai](https://developer.akamai.com/api/) API client.\n\n[Akamai {OPEN} EdgeGrid Authentication](https://developer.akamai.com/introduction/Client_Auth.html) for Golang.\n\n`edgegrid` implements the [Akamai {OPEN} EdgeGrid Authentication](https://developer.akamai.com/introduction/Client_Auth.html) scheme for the Golang `net/http` package, and also offers a convenience API for interacting with the Akamai [GTM](https://developer.akamai.com/api/luna/config-gtm/overview.html) and [PAPI](https://developer.akamai.com/api/luna/papi/overview.html) APIs.\n\n## Installation\n\nAssuming Golang is properly installed:\n\n```bash\ngo get github.com/comcast/go-edgegrid/edgegrid\n```\n\n## Basic Usage\n\nBasic usage assumes you've established up the following environment variables.\n\n```bash\nAKAMAI_EDGEGRID_HOST=\nAKAMAI_EDGEGRID_CLIENT_TOKEN=\nAKAMAI_EDGEGRID_ACCESS_TOKEN=\nAKAMAI_EDGEGRID_CLIENT_SECRET=\n```\n\nTo log request/response details:\n\n```bash\nAK_LOG=true\n```\n\n### GTMClient\n\n```go\nimport \"github.com/comcast/go-edgegrid/edgegrid\"\n\nclient := edgegrid.NewGTMClient()\n\n// get all domains\nclient.Domains()\n\n// get domain\nclient.Domain(\"example.akadns.net\")\n\n// create domain\ndomain := \u0026Domain{\n  // your data here; see resources.go\n}\nclient.DomainCreate(domain)\n\n// update domain\ndomain := \u0026Domain{\n  // your data here; see gtm_resources.go\n}\nclient.DomainUpdate(domain)\n\n// delete domain\n// NOTE: this may 403, as it appears Akamai professional services is needed to perform DELETEs\nclient.DomainDelete(\"domain\")\n\n// get datacenters info for domain\nclient.DataCenters(\"domain\")\n\n// get datacenter info by dc id\nclient.DataCenter(\"domain\", \"123\")\n\n// get datacenter info by dc nickname\nclient.DataCenterByName(\"domain\", \"some_nickname\")\n\n// create datacenter\ndc := \u0026DataCenter{\n  // your data here; see gtm_resources.go\n}\nclient.DataCenterCreate(\"domain\", dc)\n\n// update datacenter\ndc := \u0026DataCenter{\n  // your data here; see gtm_resources.go\n}\nclient.DataCenterUpdate(\"domain\", dc)\n\n// delete datacenter by id\nclient.DataCenterDelete(\"domain\", \"123\")\n\n// get property info\nclient.Property(\"domain\", \"property\")\n\n// create property\nprop := \u0026Property{\n  // your data here; see gtm_resources.go\n}\nclient.PropertyCreate(\"domain\", prop)\n\n// adjust aspects of a property\nprop := \u0026Property{\n  // your data here; see gtm_resources.go\n}\nclient.PropertyUpdate(\"domain\", prop)\n\n// delete a property\nclient.PropertyDelete(\"domain\", \"property\")\n```\n\n### PAPIClient\n\n```go\nimport \"github.com/comcast/go-edgegrid/edgegrid\"\n\nclient := edgegrid.NewPAPIClient()\n\n// get all PAPI groups\nclient.Groups()\n\n// get all PAPI products\nclient.Groups(\"someContractId\")\n\n// get all PAPI CP codes for a contract and group\nclient.CpCodes(\"someContractId\", \"someGroupID\")\n\n// get a PAPI CP code\nclient.CpCode(\"someCPCodeID\", \"someContractId\", \"someGroupID\")\n\n// get all PAPI hostnames for a contract \u0026 group\nclient.Hostnames(\"someContractId\", \"someGroupID\")\n\n// get a PAPI hostname for a contract \u0026 group\nclient.Hostnames(\"someHostID\", \"someContractId\", \"someGroupID\")\n\n// get all PAPI properties for a contract \u0026 group\nclient.Properties(\"someContractId\", \"someGroupID\")\n\n// get a PAPI property for a contract \u0026 group\nclient.Property(\"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get all PAPI property versions for a property, contract, \u0026 group\nclient.Versions(\"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get a PAPI property version for a property, contract, \u0026 group\nclient.Version(\"somePropertyVersion\", \"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get a PAPI property version XML for a property, contract, \u0026 group\nclient.PropertyVersionXML(\"somePropertyVersion\", \"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get the latest PAPI property version for a property, contract, \u0026 group\nclient.PropertyLatestVersion(\"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get the PAPI property rules for a property, contract, \u0026 group\nclient.PropertyRules(\"somePropertyID\", \"someContractId\", \"someGroupID\")\n\n// get the PAPI property activations for a property, contract, \u0026 group\nclient.PropertyActivations(\"somePropertyID\", \"someContractId\", \"someGroupID\")\n```\n\n### Alternative Usage\n\nIn addition to the `edgegrid.GTMClient` and `edgegrid.PAPIClient` convenience clients, `edgegrid.Auth` offers a standalone implementation of the [Akamai {OPEN} EdgeGrid Authentication](https://developer.akamai.com/introduction/Client_Auth.html) scheme for the Golang net/http library and can be used independent of the `GTM` and `PAPI` convenience clients.\n\n`edgegrid.Auth` offers a utility for establishing a valid `Authorization` header for use with authenticated requests to Akamai using your own HTTP client.\n\nExample:\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \"io/ioutil\"\n  \"net/http\"\n  \"os\"\n\n  \"github.com/comcast/go-edgegrid/edgegrid\"\n)\n\nfunc main() {\n  client := \u0026http.Client{}\n  req, _ := http.NewRequest(\"GET\", \"\u003cSOME_AKAMAI_URL\u003e\", nil)\n  accessToken := os.Getenv(\"AKAMAI_EDGEGRID_ACCESS_TOKEN\")\n  clientToken := os.Getenv(\"AKAMAI_EDGEGRID_CLIENT_TOKEN\")\n  clientSecret := os.Getenv(\"AKAMAI_EDGEGRID_CLIENT_SECRET\")\n  params := edgegrid.NewAuthParams(req, accessToken, clientToken, clientSecret)\n  auth := edgegrid.Auth(params)\n\n  req.Header.Add(\"Authorization\", auth)\n\n  resp, _ := client.Do(req)\n  contents, _ := ioutil.ReadAll(resp.Body)\n\n  fmt.Printf(\"%s\\n\", string(contents))\n}\n```\n\n## Run tests\n\nTests use the built-in `testing` package:\n\n```bash\nmake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Fgo-edgegrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomcast%2Fgo-edgegrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Fgo-edgegrid/lists"}