Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Apigee X API and KVM

Hello

I'm trying to use the recently release (2nd of June 2022) API to interact with environment KVM (and more precisely, KVM entries create)

Creating a KVM (and listing KVM) is workgin fine, not problem:

 

$ export TOKEN=$(gcloud auth print-access-token)

$ curl -H "Authorization: Bearer $TOKEN" \
   -X GET \
   "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps"
[]

$ curl -H "Authorization: Bearer $TOKEN" \
   -X POST \
   "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps" \ 
   -H "Content-Type: application/json" \
   -d '{"name":"KVM_Test", "encrypted":true}'
{
"name": "KVM_Test",
"encrypted": true
}

$ curl -H "Authorization: Bearer $TOKEN" \
   -X GET "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps"
[
"KVM_Test"
]

 

Liste entries seems to work (empty KVM):

 

$ curl -H "Authorization: Bearer $TOKEN" -X GET \
   "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps/KVM_Test/entries"
{
"keyValueEntries": [],
"nextPageToken": ""
}

 

However, I cannot list existing KEYS, nor to create  key:

 

$ curl -H "Authorization: Bearer $TOKEN" -X GET \
   "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps/KV-Other-Test/entries"
{
	"error": {
		"code": 500,
		"message": "Invalid key length 64 for EnvKvmKey",
		"status": "INTERNAL",
		"details": [{
			"@type": "type.googleapis.com/google.rpc.PreconditionFailure",
			"violations": [{
				"subject": "[2002:a17:530:4b4c::]:4146:wdnf1:9842:570074:70547162",
				"description": "Invalid key length 64 for EnvKvmKey"
			}]
		}, {
			"@type": "type.googleapis.com/google.rpc.RequestInfo",
			"requestId": "3941513199778787966"
		}]
	}
}

$ curl -H "Authorization: Bearer $TOKEN" -X POST \
   "https://apigee.googleapis.com/v1/organizations/<myOrg>/environments/<myEnv>/keyvaluemaps/KVM_Test/entries" \
   -H "Content-Type: application/json" \
   -d '{"name":"keyName1", "value":"keyValue1"}'

{
	"error": {
		"code": 500,
		"message": "Error while encrypting for encrypted KeyValueMap KeyValueMapScope {ScopeType ='ENVIRONMENTS', Organization = '<myOrg>', Environment = '<myEnv>'}",
		"status": "INTERNAL",
		"details": [{
			"@type": "type.googleapis.com/google.rpc.PreconditionFailure",
			"violations": [{
				"type": "keyvaluemap.service.ErrorDuringEncryption",
				"subject": "[2002:a17:531:4b0a::]:4046:wdog3:9896:392908:78644714",
				"description": "Error while encrypting for encrypted KeyValueMap KeyValueMapScope {ScopeType ='ENVIRONMENTS', Organization = 'myOrg', Environment = 'myEnv'}"
			}]
		}, {
			"@type": "type.googleapis.com/google.rpc.RequestInfo",
			"requestId": "5068192461593099311"
		}]
	}
}

 

 

Does anyone know how to use these endpoints?

 

Thanks

Arnaduga

 

 

Solved Solved
0 8 970
1 ACCEPTED SOLUTION

Yes, that is what it means. 

View solution in original post

8 REPLIES 8
Top Solution Authors