Skip to content

Commit

Permalink
Merge pull request #111 from akamai/release/1.0.0
Browse files Browse the repository at this point in the history
Release/1.0.0 EdgeGrid Golang Library
* Official release for the EdgeGrid Golang library
* DNSv2 - Zone create signature to pass blank instead of nil
* DNSv2 - Added PostMasterZoneFile func
* GTM - Datacenter API requires blank instead of nil
* PAPI - Return nil instead of error if no cp code was found
  • Loading branch information
zstlaw authored Oct 20, 2020
2 parents 439bf2c + 9b4c18f commit 5697d86
Show file tree
Hide file tree
Showing 18 changed files with 1,126 additions and 34 deletions.
27 changes: 24 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
vendor/
.idea
*.iml
# testing and custom build code
*.log

# local files
.DS_Store
/dist

# vscode
.vscode/
_debug_bin

# eclipse
.classpath
.project
.settings

# IntelliJ
/.idea/
*.ipr
*.iws
*.iml

# go dependencies
vendor/
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# EDGEGRID GOLANG RELEASE NOTES

## 2.0.0 (Oct 15, 2020)
* [IMPORTANT] Breaking changes from earlier clients. Project updated to use v2 directory structure.
* [ENHANCEMENT] PAPI - Api error return to the user when an activation or validation error occurs.
* [NOTE] Project re-organized to prepare for additional APIs to be included in future versions of this library.

## 1.0.0 (Oct 15, 2020)
* Official release for the EdgeGrid Golang library
* DNSv2 - Zone create signature to pass blank instead of nil
* PAPI - Return nil instead of error if no cp code was found
* GTM - Datacenter API requires blank instead of nil

## 0.9.18 (Jul 13, 2020)
* [AT-40][Add] Preliminary Logging CorrelationID

## 0.9.17 (Jun 9, 2020)
* Corrected AKAMAICDN target parsing
* Added endpoints for list zones, creating and updating multiple recordsets
* Refactored recordsets into separate source file

## 0.9.16 (May 29, 2020)
* Client-v1, Papi-v1 Updates
* Add lock around http request creation.
* papi - add logging to papi endpoints.

## 0.9.15 (May 15, 2020)
* DNSv2 - Added CERT, TSLA Record parsing. Removed MX Record parsing

## 0.9.14 (May 12, 2020)
* DNSv2 - Enhance RecordError functions

## 0.9.13 (Apr 26, 2020)
* DNSv2 - filterZoneCreate check upper case Type

## 0.9.12 (Apr 21, 2020)
* DNSv2 - Added optional arg to bypass dns record lock for create, update and delete functions. default preserves prior behavior

## 0.9.11 (Apr 13 , 2020)
* DNSv2 Updates
* Add additional fields, including TSIG, to zone
* Support alias zone types
* Add utility functions for Rdata parsing and process.
* Add GetRecord, GetRecordSet functions
* Add additional Recordset metadata
* Add http request/response logging

## 0.9.10 (Mar 5, 2020)
* Add support for caching Edgehostnames and Products
* Support for cache in papi library for edgehostnames and products to minimize round trips to fetch repeated common data to avoid
WAF deny rule IPBLOCK-BURST4-54013 issue

## 0.9.9 (Feb 29, 2020)
* Add support for caching Contract, Groups, and Cp Codes
* cache to minimize round trips on repeated common data fetches to avoid
WAF deny rule IPBLOCK-BURST4-54013 issue

## 0.9.0 (Aug 6, 2019)
* Added support for GTM
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Akamai OPEN EdgeGrid for GoLang
# Akamai OPEN EdgeGrid for GoLang v1

[![Build Status](https://travis-ci.org/akamai/AkamaiOPEN-edgegrid-golang.svg?branch=master)](https://travis-ci.org/akamai/AkamaiOPEN-edgegrid-golang)
[![GoDoc](https://godoc.org/github.com/akamai/AkamaiOPEN-edgegrid-golang?status.svg)](https://godoc.org/github.com/akamai/AkamaiOPEN-edgegrid-golang)
Expand All @@ -7,9 +7,23 @@

This library implements an Authentication handler for [net/http](https://golang.org/pkg/net/http/)
that provides the [Akamai OPEN Edgegrid Authentication](https://developer.akamai.com/introduction/Client_Auth.html)
scheme. For more information visit the [Akamai OPEN Developer Community](https://developer.akamai.com).
scheme. For more information visit the [Akamai OPEN Developer Community](https://developer.akamai.com). This library
has been released as a v1 library though future development will be on the v2 branch

## Usage
## Announcing Akamai OPEN EdgeGrid for GoLang v2 (release v2.0.0)

The v2 branch of this module is under active development and provides a subset of Akamai APIs for use in the
Akamai Terraform Provider. The v2 branch **does not yet** implement the full set of Akamai endpoints supported by the
0.x and 1.x releases.

New users are encouraged to adopt v2 branch it is a simpler API wrapper with little to no business logic.

Current direct users of this v0.9 library are recommended to continue to use the the v1 version as initialization
and package structure has significantly changed in v2 and will require substantial work to migrate existing
applications. Non-backwards compatible changes were made to improve the code quality and make the project more
maintainable.

## Usage of the v1 library

GET Example:

Expand Down
45 changes: 43 additions & 2 deletions configdns-v2/zone.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dnsv2

import (
"bytes"
"fmt"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1"
edge "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
Expand Down Expand Up @@ -360,6 +361,46 @@ func GetMasterZoneFile(zone string) (string, error) {
}
}

// Update Master Zone file
func PostMasterZoneFile(zone string, filedata string) error {

buf := bytes.NewReader([]byte(filedata))
req, err := client.NewRequest(
Config,
"POST",
fmt.Sprintf("/config-dns/v2/zones/%s/zone-file", zone),
buf,
)
if err != nil {
return err
}

req.Header.Set("Content-Type", "text/dns")

edge.PrintHttpRequest(req, true)

res, err := client.Do(Config, req)

// Network error
if err != nil {
return &ZoneError{
zoneName: zone,
httpErrorMessage: err.Error(),
err: err,
}
}

edge.PrintHttpResponse(res, true)

// API error
if client.IsError(res) {
err := client.NewAPIError(res)
return &ZoneError{zoneName: zone, apiErrorMessage: err.Detail, err: err}
}

return nil
}

// Create a Zone
func (zone *ZoneCreate) Save(zonequerystring ZoneQueryString, clearConn ...bool) error {
// This lock will restrict the concurrency of API calls
Expand Down Expand Up @@ -432,7 +473,7 @@ func (zone *ZoneCreate) SaveChangelist() error {
Config,
"POST",
"/config-dns/v2/changelists/?zone="+zone.Zone,
nil,
"",
)
if err != nil {
return err
Expand Down Expand Up @@ -474,7 +515,7 @@ func (zone *ZoneCreate) SubmitChangelist() error {
Config,
"POST",
"/config-dns/v2/changelists/"+zone.Zone+"/submit",
nil,
"",
)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 5697d86

Please sign in to comment.