Skip to content

Commit

Permalink
Merge pull request #129 from akamai/release/v2.4.0
Browse files Browse the repository at this point in the history
Release/v2.4.0
  • Loading branch information
robertolopezlopez committed Mar 29, 2021
2 parents 2178902 + bcfd7c7 commit cce50e9
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 64 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# EDGEGRID GOLANG RELEASE NOTES

## 2.4.0 (Mar 29, 2021) PAPI - Secure by default
*PAPI
* Support to provision default certs as part of hostnames request
* New cert status object in hostnames response if it exists

## 2.3.0 (Mar 15, 2021) Network Lists

Add support for the following operations in the Network Lists API v2:
Expand Down
35 changes: 28 additions & 7 deletions pkg/papi/propertyhostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type (
ContractID string
GroupID string
ValidateHostnames bool
IncludeCertStatus bool
}

// GetPropertyVersionHostnamesResponse contains all property version hostnames associated to the given parameters
Expand All @@ -49,10 +50,27 @@ type (

// Hostname contains information about each of the HostnameResponseItems
Hostname struct {
CnameType HostnameCnameType `json:"cnameType"`
EdgeHostnameID string `json:"edgeHostnameId,omitempty"`
CnameFrom string `json:"cnameFrom"`
CnameTo string `json:"cnameTo,omitempty"`
CnameType HostnameCnameType `json:"cnameType"`
EdgeHostnameID string `json:"edgeHostnameId,omitempty"`
CnameFrom string `json:"cnameFrom"`
CnameTo string `json:"cnameTo,omitempty"`
CertProvisioningType string `json:"certProvisioningType"`
CertStatus CertStatusItem `json:"certStatus,omitempty"`
}

CertStatusItem struct {
ValidationCname ValidationCname `json:"validationCname,omitempty"`
Staging []StatusItem `json:"staging,omitempty"`
Production []StatusItem `json:"production,omitempty"`
}

ValidationCname struct {
Hostname string `json:"hostname,omitempty"`
Target string `json:"target,omitempty"`
}

StatusItem struct {
Status string `json:"status,omitempty"`
}

// UpdatePropertyVersionHostnamesRequest contains parameters required to update the set of hostname entries for a property version
Expand All @@ -62,6 +80,7 @@ type (
ContractID string
GroupID string
ValidateHostnames bool
IncludeCertStatus bool
Hostnames []Hostname
}

Expand Down Expand Up @@ -115,12 +134,13 @@ func (p *papi) GetPropertyVersionHostnames(ctx context.Context, params GetProper
logger.Debug("GetPropertyVersionHostnames")

getURL := fmt.Sprintf(
"/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s&validateHostnames=%t",
"/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s&validateHostnames=%t&includeCertStatus=%t",
params.PropertyID,
params.PropertyVersion,
params.ContractID,
params.GroupID,
params.ValidateHostnames)
params.ValidateHostnames,
params.IncludeCertStatus)

req, err := http.NewRequestWithContext(ctx, http.MethodGet, getURL, nil)
if err != nil {
Expand Down Expand Up @@ -148,12 +168,13 @@ func (p *papi) UpdatePropertyVersionHostnames(ctx context.Context, params Update
logger.Debug("UpdatePropertyVersionHostnames")

putURL := fmt.Sprintf(
"/papi/v1/properties/%s/versions/%v/hostnames?contractId=%s&groupId=%s&validateHostnames=%t",
"/papi/v1/properties/%s/versions/%v/hostnames?contractId=%s&groupId=%s&validateHostnames=%t&includeCertStatus=%t",
params.PropertyID,
params.PropertyVersion,
params.ContractID,
params.GroupID,
params.ValidateHostnames,
params.IncludeCertStatus,
)

req, err := http.NewRequestWithContext(ctx, http.MethodPut, putURL, nil)
Expand Down
Loading

0 comments on commit cce50e9

Please sign in to comment.