akamai / akamaiopen-edgegrid-golang Goto Github PK
View Code? Open in Web Editor NEWThis library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme
License: Apache License 2.0
This library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme
License: Apache License 2.0
Hi! It would be great to have some common examples how to work with different APIs using packages in this repo, for example papi-v1
.
I get the following error when trying to get and update rules for a property
API Error: 400 400 Bad Request There was a problem extracting the contract and group id. Please explicitly pass in the contract id and group id you wish to use. More Info https://problems.luna.akamaiapis.net/papi/v0/problem-extracting-contract-group
As a workaround I've implemented my own functions that passes these in the API call.
# Example for getting rules for property
req, err := client.NewRequest(
api.Config,
"GET",
fmt.Sprintf(
"/papi/v1/properties/%s/versions/%d/rules?contractId=%s&groupId=%s",
prop.PropertyID,
prop.LatestVersion,
prop.ContractID, # These are added
prop.GroupID, # These are added
),
nil,
)
These lines correspond to https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/master/papi-v1/rules.go#L48-L57
$ go get github.com/akamai/AkamaiOPEN-edgegrid-golang
go: finding github.com/h2non/gock v0.0.0-00010101000000-000000000000
go: github.com/h2non/[email protected]: unknown revision 000000000000
go: error loading module requirements
I have go mod
enabled
$ ls
go.mod
go.mod
file
module scratch-space
go 1.12
It had worked in the previous version.
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/v0.9.0/go.mod#L14
gopkg.in/h2non/gock.v1 v1.0.15
Changed to
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/v0.9.1/go.mod#L7
github.com/h2non/gock v0.0.0-00010101000000-000000000000
...
replace github.com/h2non/gock => gopkg.in/h2non/gock.v1 v1.0.14
Clues as to what I'm doing wrong?
There isn't an issue when running it without go mod
afaik.
Getting import collision when using
case-insensitive import collision: "github.com/Sirupsen/logrus" and "github.com/sirupsen/logrus"
Go Environment:
go version go1.7.1 darwin/amd64
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xf/zmmkj8k17lg8cv8hny0h7k8m0000gn/T/go-build046404517=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
some RESTful apis in akamai developer need specific http headers such as PAPI-Use-Prefixes: true
, how can I insert the headers into my post/get requests?
Hi, I'm trying to interact with Akamai Property API via papi-v1
module, but I've faced the problem with blocking me while I was trying to get a list of hostnames. Error: "API Error: 400 Bad Request WAF deny rule IPBLOCK-BURST4-54013".
The example:
config, _ := edgegrid.Init("~/.edgerc", "papi")
papi.Init(config)
contracts := papi.NewContracts()
err := contracts.GetContracts()
if err != nil {
log.Fatal(err)
}
contract, err := contracts.FindContract(contractName)
if err != nil {
log.Fatal(err)
}
groups := papi.NewGroups()
err = groups.GetGroups()
if err != nil {
log.Fatal(err)
}
group, err := groups.FindGroup(groupName)
if err != nil {
log.Fatal(err)
}
properties := papi.NewProperties()
err = properties.GetProperties(contract, group)
if err != nil {
log.Fatal(err)
}
property, err := properties.FindProperty(propertyID)
if err != nil {
log.Fatal(err)
}
v, err := property.GetLatestVersion("")
if err != nil {
log.Fatal(err)
}
hostnames := papi.NewHostnames()
err = hostnames.GetHostnames(v)
if err != nil {
log.Fatal(err)
}
for _, h := range hostnames.Hostnames.Items {
fmt.Printf("%+v\n", h)
}
UPD:
Debug helped me to find out that the client does a hell of a lot of requests during execution of properties.GetProperties(contract, group)
. That's because of post unmarshall
hook that's defined here: https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/master/papi-v1/properties.go#L342
So because of that I exceed the limit of requests and the Akamai API blocks me. Is there any chance to fix/get rid of that post unmarshall
hook in the package? I'd be glad to help.
I need to pass a proxy through when making the client.NewRequest
call.
Is there a way where I can initialize the client and use that client to make the call with or with out a proxy?
I find myself doing this and it makes a bit of overkill that I have to go through validating a proxy address before I need to make an API call.
func vpnAvailability(akamaiConf edgegrid.Config, domain, property, proxy string) ([]DataRow, error) {
if proxy != "" {
proxyURL, err := url.Parse(proxy)
if err != nil {
return nil, err
}
transport := http.DefaultTransport.(*http.Transport)
transport.Proxy = http.ProxyURL(proxyURL)
hc := *http.DefaultClient
hc.Transport = transport
// client is the akamai package name
client.Client = &hc
}
req, err := client.NewRequest .....
Hi everyone,
I've bumped into a strange issue: when I create GTM domains with liveness tests that have TestTimeout
set other than 0
or have HttpHeaders
other than nil
, then the create request fails with the following error:
"Domain \"example.akadns.net\" validation failed: [The signature does not match]"
Example failing request:
gtm := configgtm.Domain{
Name: "example.akadns.net",
Type: "weighted",
Datacenters: []*configgtm.Datacenter{
{
Nickname: "example-dc",
DatacenterId: 4000,
},
},
Properties: []*configgtm.Property{
{
Name: "example-property",
HandoutMode: "all-live-ips",
Type: "weighted-round-robin",
ScoreAggregationType: "worst",
TrafficTargets: []*configgtm.TrafficTarget{
{
DatacenterId: 4000,
Enabled: true,
Servers: []string{"1.2.3.4"},
Weight: 1,
},
},
LivenessTests: []*configgtm.LivenessTest{
{
Name: "example liveness test",
PeerCertificateVerification: false,
TestInterval: 30,
TestObject: "/",
HttpError3xx: true,
HttpError4xx: true,
HttpError5xx: true,
Disabled: false,
TestObjectProtocol: "HTTP",
TestObjectPort: 80,
DisableNonstandardPortWarning: true,
HttpHeaders: []*configgtm.HttpHeader{
{
Name: "Host",
Value: "example.com",
},
},
TestTimeout: 5,
AnswersRequired: false,
RecursionRequested: false,
},
},
},
},
}
response, err = gtm.Create(nil)
Example working request:
gtm := configgtm.Domain{
Name: "example.akadns.net",
Type: "weighted",
Datacenters: []*configgtm.Datacenter{
{
Nickname: "example-dc",
DatacenterId: 4000,
},
},
Properties: []*configgtm.Property{
{
Name: "example-property",
HandoutMode: "all-live-ips",
Type: "weighted-round-robin",
ScoreAggregationType: "worst",
TrafficTargets: []*configgtm.TrafficTarget{
{
DatacenterId: 4000,
Enabled: true,
Servers: []string{"1.2.3.4"},
Weight: 1,
},
},
LivenessTests: []*configgtm.LivenessTest{
{
Name: "example liveness test",
PeerCertificateVerification: false,
TestInterval: 30,
TestObject: "/",
HttpError3xx: true,
HttpError4xx: true,
HttpError5xx: true,
Disabled: false,
TestObjectProtocol: "HTTP",
TestObjectPort: 80,
DisableNonstandardPortWarning: true,
// HttpHeaders: []*configgtm.HttpHeader{
// {
// Name: "Host",
// Value: "example.com",
// },
// },
// TestTimeout: 5,
AnswersRequired: false,
RecursionRequested: false,
},
},
},
},
}
response, err = gtm.Create(nil)
I would appreciate any help on this problem.
Thank you!
I'm using GTM v1.4.
'go get ' fails with the error below.
go: github.com/akamai/[email protected] requires
github.com/h2non/[email protected]: invalid version: unknown revision 000000000000
The API Gateway module installation throws the following error:
$ akamai install https://github.com/akamai/cli-api-gateway.git
Attempting to fetch command from https://github.com/akamai/cli-api-gateway.git...... [OK]
Installing...... [FAIL]
Unable to build binary: exit status 1
After some digging I figured out this is due to a missing dependency github.com/spf13/cast
in the master CLI package as apikey-manager-v1
and api-endpoints-v2
import it but don't specify in the deps file.
Hi,
I'm playing with the networklists API and it seems that when a 4xx happens when activating a network list the error is not handled. Instead, in the function CreateActivations()
just after the call to p.Exec(req, &rval, params)
we're not making a check to resp.StatusCode
but we're trying to get the new activation status directly --> this call will succeed and the entire call to CreateActivations()
will succeed.
I think that we must add the following check on line 353 (based on v6.0.0):
if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}
Cheers
In the rule validation step, currently check whether rule contains one ore more behavior.
But in fact, rules with empty behavior are also acceptable in Akamai, and it is very common case when write the nested rules.
Is it possible to get rid of required validation from Behavior?
By this validation, some users find error with terraform akamai provider.
akamai/terraform-provider-akamai#194
I'm using terraform to provision a property, and ran into a case where it drops behaviors (and criteria).
It happens whenever the "name" is the same for two behaviours (or two criteria) within the same rule.
eg.
if I terraform a property with the following rule...
{
"name": "Restrict Method",
"children": [],
"behaviors": [
{
"name": "constructResponse",
"options": {
"enabled": true,
"body": "<html>\n <head>\n <title>405 Method Not Allowed.</title>\n </head>\n <body>\n <h1>Error 405 Method Not Allowed.</h1>\n <p>Method Not Allowed.</p>\n </body>\n</html>",
"responseCode": 405,
"forceEviction": false
}
}
],
"criteria": [
{
"name": "requestMethod",
"options": {
"matchOperator": "IS_NOT",
"value": "GET"
}
},
{
"name": "requestMethod",
"options": {
"matchOperator": "IS_NOT",
"value": "HEAD"
}
},
{
"name": "requestMethod",
"options": {
"matchOperator": "IS_NOT",
"value": "OPTIONS"
}
}
],
"criteriaMustSatisfy": "all",
"comments": "Only allow GET, HEAD and OPTIONS"
}
I get a property with the rule below (ie. only the last criteria)...
{
"name": "Restrict Method",
"children": [],
"behaviors": [
{
"name": "constructResponse",
"options": {
"enabled": true,
"body": "<html>\n <head>\n <title>405 Method Not Allowed.</title>\n </head>\n <body>\n <h1>Error 405 Method Not Allowed.</h1>\n <p>Method Not Allowed.</p>\n </body>\n</html>",
"responseCode": 405,
"forceEviction": false
}
}
],
"criteria": [
{
"name": "requestMethod",
"options": {
"matchOperator": "IS_NOT",
"value": "OPTIONS"
}
}
],
"criteriaMustSatisfy": "all",
"comments": "Only allow GET, HEAD and OPTIONS"
}
This is be a bug in this underlying go package... ie. this code replaces duplicate names instead of adding them...
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/master/papi-v1/rules.go#L221-L277
While the tests indicate this is intended behaviour, it doesn't make sense for behaviors or criteria, since names can be duplicates by design.
We're using this package along with our own logging package that uses logrus and getting this error:
case-insensitive import collision: "github.com/Sirupsen/logrus" and "github.com/sirupsen/logrus"
This is because sirupsen/logrus#543
The appsec.UpdateWAFProtection request misses the request body. To disable/enable the WAF protection, the following request body must be submitted:
{"protections":{"APP_LAYER_RULES":false|true}}
Using the method right now leads to an internal server error as the body is missing:
{
"type": "https://problems.luna.akamaiapis.net/appsec/error-types/INTERNAL-SERVER-ERROR",
"status": 500,
"title": "Internal Server Error",
"detail": "Error occurred while processing the request.",
"instance": "https://problems.luna.akamaiapis.net/appsec/error-instances/<id>"
}
I'm really curious why getProperty func from property.go does not return only Property struct but also Response and allProperties.
It does not make any sense ...look here getPropertyResponse
GetRecordList uses the /zone/recordsets API endpoint but does not support pagination, so it may be impossible to get all the matching records.
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/9e9c0b/configdns-v2/record_lookup.go#L119
I think maybe it should just wrap GetRecordsets, which does support pagination, and add extra optional parameters to be passed through? But I don't really understand the API for GetRecordList (it takes a "name" parameter which seems to only be used when constructing an error?) so I'm not sure.
Not able to find below in
https://techdocs.akamai.com/cloudlets/v2/reference/post-policy-version-rules
https://techdocs.akamai.com/cloudlets/v2/reference/get-policy-version-rule
https://techdocs.akamai.com/cloudlets/v2/reference/put-policy-version-rule
Does the package doesn't support these 3 ?? But i do objects for match-rules but no get,post,put only validate
StateOrProvince element name is spelled wrong, e.g. SstateOrProvince in Datacenter struct
Hi folks,
I'm implementing this go client into my crossplane provider.
I'm calling createProperty func from PAPI API, which returns me an error: 401 Unauthorized: The signature does not match. I need to increase body size limit for http request. Is there any supporting function for that ?
Thanks
Hi folks, seems like there is a bit of a bug when parsing the host from the edgegrid
library, which causes issues when signing the auth header for the server. We should rectify this by altering instructions or by appending the appropriate protocol to the request URL.
Here's what id expect to do based on your instructions:
edgerc := akamai.Must(akamai.New(
akamai.WithFile(".edgerc"),
))
client := &http.Client{
Timeout: 3 * time.Second,
}
req, _ := http.NewRequest(http.MethodGet, "/gtm-api/v1/reports/domain-list", nil)
edgerc.SignRequest(req)
resp, err := client.Do(req)
if err != nil {
log.Println("failed to make request")
log.Fatal(err)
}
Which leads to 2023/02/15 12:06:41 Get "//akab-zpqlazcvjpvvkirv-tarozpg25ilmzdhi.luna.akamaiapis.net/gtm-api/v1/reports/domain-list": unsupported protocol scheme ""
This is what I actually need to do:
edgerc := akamai.Must(akamai.New(
akamai.WithFile(".edgerc"),
))
client := &http.Client{
Timeout: 3 * time.Second,
}
req, _ := http.NewRequest(http.MethodGet, "/gtm-api/v1/reports/domain-list", nil)
endpoint := fmt.Sprintf("https:%s", req.URL)
parsedUrl, err := url.Parse(endpoint)
if err != nil {
log.Fatal(err)
}
req.URL = parsedUrl
edgerc.SignRequest(req)
resp, err := client.Do(req)
if err != nil {
log.Println("failed to make request")
log.Fatal(err)
}
Minor adjustments, but think it would help others when setting up clients for the first time. :) My .edgrerc file is correct, I have my hostname from the credentials I've created, but apparently something doesn't update it correctly. I believe this happens in the http package.
github.com/akamai/AkamaiOPEN-edgegrid-golang/configgtm-v1_3
# github.com/akamai/AkamaiOPEN-edgegrid-golang/configgtm-v1_3
./datacenter.go:213:59: conversion from int to string yields a string of one rune
./datacenter.go:263:59: conversion from int to string yields a string of one rune
FAIL github.com/akamai/AkamaiOPEN-edgegrid-golang/configgtm-v1_3 [build failed]
error: Bad exit status from /var/tmp/rpm-tmp.BoK9mf (%check)
This issue is due too golang/go#32479
Hello all,
I noticed that enrollment ID isn't parsed from the API response.
However ID is needed in other API calls for example get-deployment-production.
There is a method ListEnrollments. It returns ListEnrollmentsResponse. ListEnrollmentsResponse contains list of Enrollments. However ID
isn't parsed but it is returned from API call get-enrollments.
Hi,
Found there are some missing fields in the create client list items object, on the docs ListId
& Type
are possible, but missing in the Go Code
Have added the diff below which might address it.
Cheers, James
diff --git a/pkg/clientlists/client_list.go b/pkg/clientlists/client_list.go
index 2ac065a..fa8197a 100644
--- a/pkg/clientlists/client_list.go
+++ b/pkg/clientlists/client_list.go
@@ -114,6 +114,8 @@ type (
// ListItemPayload contains item's editable fields to use as update/create/delete payload
ListItemPayload struct {
Value string `json:"value"`
+ ListID string `json:"listId"`
+ Type string `json:"type"`
Tags []string `json:"tags"`
Description string `json:"description"`
ExpirationDate string `json:"expirationDate"`
We want to update the GTM weights through "AkamaiOPEN-edgegrid-golang".
We are currently using below approach
req, _ := client.NewJSONRequest(config, "PUT", "/config-gtm/v1/domains/{domainname}/properties/{gtmname}", body)
resp, _ := client.Do(config, req)
config
has the token details,
body
has the actual payload that we use in making the API (PUT) call
It works with REST client (POSTMAN). But while using the same payload with client.NewJSONRequest
, we are seeing below error
{
"type" : "https://problems.luna.akamaiapis.net/config-gtm/v1/illegalBody",
"title" : "Illegal request body",
"instance" : "<instance-id>",
"status" : 422,
"detail" : "The JSON request body contained a syntax error",
"problemId" : "<problem-id>"
}
Hi,
I am using this library to update rule tree using PAPI API. Creating a new property version works fine. However when updating a rule criteria the Luna API server returns this error :
"type" : "https://problems.luna.akamaiapis.net/papi/v0/property-version/lock-error",
"title" : "Unable to edit read-only element",
"status" : 403,
"detail" : "Only Akamai representatives can change read-only behaviors, criteria and child rules.",
I am using the PUT example. Does client.NewJSONRequest() expect a JSON object in the "body", or just passing a struct is ok ?
Vivek
Fixes issues like:
...
This library interferes with application logging by logging its own data and even mutating the global log level (!). Additionally, it seems that the logging can log secrets to disk (I can see access tokens in what's logged) which is not permitted under our security practices.
Instead, the library should take in some kind of logging interface in the edgegrid.Config. In its absence, it could use a default logger to print to stdout.
Please add support for ingesting credentials from a .edgerc file. An example of this can be found in the Python signing library at https://github.com/akamai-open/AkamaiOPEN-edgegrid-python . An .edgerc file is simply a .ini file that is commonly used to store credentials used in requests to the OPEN API. Any .ini parser should be able to read it as it is in standard .ini format. This file is most often stored in the users home directory (i.e. "~/.edgerc"), but your program should accept a path to this file as one of it's params.
given the following
f, _ := os.Open(jsonPath)
b, _ := ioutil.ReadAll(f)
var prop property
json.Unmarshal(b, &prop)
req, _ := client.NewJSONRequest(config, http.MethodPut, filepath.Join("/", "config-gtm", "v1", "domains", domName, "properties", propName), prop)
res, _ := client.Do(config, req)
b, _ = ioutil.ReadAll(res.Body)
println(string(b))
where f
looks like
{
"balanceByDownloadScore": false,
"dynamicTTL": 60,
"failoverDelay": 0,
"failbackDelay": 0,
"handoutLimit": 0,
"handoutMode": "normal",
"lastModified": "",
"livenessTests": [
{
"name": "Health",
"testInterval": 60,
"testObjectProtocol": "HTTP",
"testTimeout": 25
}
],
"name": "baz",
"scoreAggregationType": "worst",
"stickinessBonusConstant": 0,
"stickinessBonusPercentage": 0,
"staticTTL": 30,
"trafficTargets": [
{
"datacenterId": 1,
"enabled": true,
"weight": 1,
"servers": [
"1.2.3.4"
]
},
{
"datacenterId": 2,
"enabled": true,
"weight": 0,
"servers": [
"5.6.7.8"
]
}
],
"type": "weighted-round-robin",
"useComputedTargets": false,
"ipv6": false,
"links": [
{
"rel": "self",
"href": "https://foo.luna.akamaiapis.net/config-gtm/v1/domains/bar/properties/baz"
}
]
}
i get the following error
{
"type" : "https://problems.luna.akamaiapis.net/config-gtm/v1/propertyValidationFailed",
"title" : "Property Validation Failure",
"status" : 400,
"errors" : [ {
"type" : "https://problems.luna.akamaiapis.net/config-gtm/v1/propertyValidationError",
"title" : "Property Validation Error",
"detail" : "Property \"baz\", liveness test \"Health\": test object name is missing"
} ]
}
this error is throwing me for a loop. it claims the liveness test Health
is missing a name while referring to it by name. what am i missing here?
i have been referencing property-vnd.config-gtm.v1.3.schema.json
fwiw
I'm trying to setup a very simple script to get the list of cps enrollments, but when I run it an error is returned.
package main
import (
"log"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/cps-v2"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
)
func main() {
config, _ := edgegrid.Init(".edgerc", "default")
cps.Init(config)
contractID := "#-######"
params := cps.ListEnrollmentsQueryParams{ContractID: contractID}
enrollments, err := cps.ListEnrollments(params)
if err != nil {
log.Panicln(err)
}
log.Println(enrollments)
}
which returns
2020/04/15 18:48:20 API Error: 400 400 Bad Request More Info https://problems.luna.akamaiapis.net/-/resource-impl/forward-origin-error
and the link is conveniently broken as well.
It looks like Pull Request #74 was trying to fix this but has not been addressed.
在 pkg/edgegrid 的README.md中的Basic Example
if err := edgerc.Sign(r); err != nil {
log.Fatalln(err)
}
change into
edgerc.SignRequest(req)
Because there is no Sign method in the original code, the Sign method is replaced by SignRequest
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x887de9]
goroutine 16199 [running]:
sparta-admin/storage-server/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1.IsError(...)
/root/go/src/sparta-admin/storage-server/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/errors.go:106
sparta-admin/storage-server/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/papi-v1.Search(0xeaaaaf, 0xc, 0x0, 0x0, 0x987bb8, 0xd93c20, 0xc00023ade0)
/root/go/src/sparta-admin/storage-server/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/papi-v1/search.go:53 +0x179
sparta-admin/storage-server/modules/akamai.(*AkaApi).CreateDomain(0xc0002df450, 0xc000e5ad42, 0xe, 0xc000e5b2b0, 0xc, 0xc000e5b2a0, 0x9, 0x0, 0xc0003dd980)
/root/go/src/sparta-admin/storage-server/modules/akamai/aka.go:454 +0x139
sparta-admin/storage-server/service/server.(*SpartaAdminServerImpl).BusinessActiveAkamai.func1(0xc00034ee80, 0xc000e5ad42, 0xe, 0xc0003e4ea0, 0xc000b86da0)
/root/go/src/sparta-admin/storage-server/service/server/sparta.go:545 +0x7d
created by sparta-admin/storage-server/service/server.(*SpartaAdminServerImpl).BusinessActiveAkamai
/root/go/src/sparta-admin/storage-server/service/server/sparta.go:542 +0x399
Describe the issue
Using this library for the SIEM API (https://techdocs.akamai.com/siem-integration/reference/get-configid) returns a 400 error for missing parameters.
To Reproduce
Steps to reproduce the behavior:
import (
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid"
...
)
config := &edgegrid.Config{
Host: host,
ClientToken: clienttoken,
ClientSecret: clientsecret,
AccessToken: accesstoken,
}
path := "siem/v1/configs/12345?from=1488816784&to=1488816442&limit=1"
req, err := http.NewRequest("GET", fmt.Sprintf("https://%s/%s", host, path), nil)
if err != nil {
fmt.Println(err)
}
config.SignRequest(req)
client := &http.Client{}
resp,err2 := client.Do(req)
if err2 != nil{
fmt.Println(err2)
}
out, _ := io.ReadAll(resp.Body)
var unmarshal map[string]interface{}
json.Unmarshal(out, &unmarshal)
fmt.Printf("%+v",string(out))
Expected behavior
An endpoint with a similar format https://host/prolexic-analytics/v2/time-series?destinations=ip&locations=agr&source=both
works with this library using the above example, so it is unexpected for the SIEM endpoint not to work.
Actual behavior
It outputs this error.
{
'type': 'https://problems.cloudsecurity.akamaiapis.net/siem/v1/missing-parameters',
'title': 'Missing mandatory parameter(s) or illegal parameter parameter(s) in the request',
'instance': 'https://{host}/siem/v1/configs/{configid}?from={from}',
'detail': 'Missing mandatory parameter(s) or illegal parameter parameter(s) in the request',
'method': 'GET'
...
}
Judging from the instance
above, it appears that only the first query parameter is being recognized. If the &
character is encoded to %26
in the signature generation then the instance
variable changes to 'instance': 'https://{host}/siem/v1/configs/{configid}?from={from}&to={to}&limit={limit}'
, but gives a 401 error for the signature not matching. If the &
character is encoded to %26
in the request and signature, then it returns a 400 error for missing parameters.
Please add a working example using this library for this endpoint (https://techdocs.akamai.com/siem-integration/reference/get-configid).
Hi,
This is NOT an issue, just heads up about this very basic new library we wrote for Akamai Edge Authorization Token in Golang https://github.com/mobilerider/EdgeAuth-Token-Golang, in case someone needs it. I noticed you had a version for PHP, Node and Python but Golang was missing. If you think it's decent enough pls be free to include it somewhere in your repo. Borrowed part of your README, hope it's OK.
I'll close this upon acknowledge, sorry in advance, I know this is probably not the best way, don't know any other, tried [email protected].
Thanks.
given the following
f, _ := os.Open(jsonPath)
b, _ := ioutil.ReadAll(f)
req, _ := client.NewJSONRequest(config, http.MethodPut, path, json)
res, _ := client.Do(config, req)
b, _ = ioutil.ReadAll(res.Body)
println(string(b))
where json
looks something like
{
"balanceByDownloadScore": false,
"dynamicTTL": 60,
"failoverDelay": 0,
"failbackDelay": 0,
"handoutLimit": 0,
"handoutMode": "normal",
"lastModified": "",
"livenessTests": [
{
"name": "Health",
"testInterval": 60,
"testObjectProtocol": "HTTP",
"testTimeout": 25
}
],
"name": "baz",
"scoreAggregationType": "worst",
"stickinessBonusConstant": 0,
"stickinessBonusPercentage": 0,
"staticTTL": 30,
"trafficTargets": [
{
"datacenterId": 1,
"enabled": true,
"weight": 0.5,
"servers": [
"1.2.3.4"
]
},
{
"datacenterId": 2,
"enabled": true,
"weight": 0.5,
"servers": [
"5.6.7.8"
]
}
],
"type": "weighted-round-robin",
"useComputedTargets": false,
"ipv6": false,
"links": [
{
"rel": "self",
"href": "https://foo.luna.akamaiapis.net/config-gtm/v1/domains/bar/properties/baz"
}
]
}
i'm receiving the following error
{
"type" : "https://problems.luna.akamaiapis.net/config-gtm/v1/malformedRequestEntity",
"title" : "Bad Request",
"status" : 400,
"detail" : "JSON parse error: Cannot construct instance of `com.akamai.originservices.gtm.api.v1.property.Property` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ... at [Source: (PushbackInputStream); line: 1, column: 1]"
}
i took a look at property-vnd.config-gtm.v1.3.schema.json
and i seem to have all the required fields. am i missing something here?
Hi,
I'm developing a crowdsec bouncer that will add banned IP adresses to an IP blacklist.
I've developed a tiny library around the network-list API: https://github.com/atefhaloui/akamai-network-lists
Everytime I test adding new IP to my IP blacklist I receive 422 Unprocessable Request
{
"detail": "The entry 195.109.4.59/32 already exists in the list",
"instance": "https://problems.luna.akamaiapis.net/network-lists-activation/error-instances/6c94c1aa-df40-436e-b04e-1a8935194ca2",
"status": 422,
"title": "The instructions in this request cannot be procesed",
"type": "https://problems.luna.akamaiapis.net/network-lists-activation/error-types/UNPROCESSABLE-REQUEST"
}
However, when looking in the Control Center --> Security Configurations --> Network List, the IP has been correctly added and the network list is set as "MODIFIED" and ready to be activated.
Do anyone know why I'm receiving this 422 error ?
Thank you
We would like to port network list functionality and code from https://github.com/apiheat/go-edgegrid/tree/master/service/netlistv2 and add it here, as we plan later to use it for terraform resources.
Please let me know if you are fine with that and that we will not be doing same work as you.
@dshafik
Expected behavior:
Calls to papi.GetGroups
and others should only print debug logs if papi.Init
was called with a config that has Debug
set to true
.
Observed behavior:
Calls to papi.GetGroups
and others print debug logging no matter what.
Cause:
Hard-coded calls to edge.PrintHttp*
functions.
Tried to create SRV
records via the terraform-provider-akamai
as a client and found it throws Validation Errors
for weight
and port
fields. On further investigation, we found out that this client requires an uint16
but terraform only supports TypeInt which is supposed to be a wrapper for all types. But on passing an integer this throws an error and just sets it to 0.
This is the current struct in record.go
-
type SrvRecord struct {
fieldMap []string `json:"-"`
Name string `json:"name,omitempty"`
TTL int `json:"ttl,omitempty"`
Active bool `json:"active,omitempty"`
Target string `json:"target,omitempty"`
Priority int `json:"priority,omitempty"`
Weight uint16 `json:"weight,omitempty"`
Port uint16 `json:"port,omitempty"`
}
On changing Weight
and Port
field to int
, it did work. Just wanted to raise this so we can find a resolution.
Additionally, this is the SRV record block we're using in our terraform code -
srv {
name = "_xmpp-server._tcp"
ttl = 3600
active = true
priority = 20
weight = 10
port = 1234
target = "intra.xyz.com."
}
Can you provide a sample of usage, just like the python sample provided on Akamai's official website.
Mainly in terms of identity verification before API interaction.
Thanks.
Can you please bump version to v0.3 after the import fixes for logrus and match master branch?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.