MapName attibute not working for kvm policy

I am trying to use the <MapName> attribute in my kvmOperations policy but it does not seem to be wokring for me. If I use mapidentifier it works

working -

<KeyValueMapOperations name="KVM.GetPasswordForUser" mapIdentifier="settings" > 
  <ExpiryTimeInSecs>300</ExpiryTimeInSecs> 
  <Get assignTo="private.password"> 
    <Key> 
      <Parameter ref="private.inputusername"/> 
    </Key> 
  </Get> 
  <Scope>environment</Scope> 
</KeyValueMapOperations>


not working

  <KeyValueMapOperations name="KVM.GetPasswordForUser"> 
    <MapName>settings</MapName> 
    <ExpiryTimeInSecs>300</ExpiryTimeInSecs> 
    <Get assignTo="private.password"> 
      <Key> 
        <Parameter ref="private.inputusername"/> 
      </Key> 
    </Get> 
    <Scope>environment</Scope> 
  </KeyValueMapOperations>

I am trying to refer to the KVM dynamically since this is in a sharedflow.

Solved Solved
1 10 654
1 ACCEPTED SOLUTION

Not applicable

I don't see any such tag <MapName> present in KVM policy.

Dynamically configuring KVM name is not possible.

I would suggest you to use one KVM and for each proxy take the proxy name as key and value as a JSON body having multiple key values as you wanted to put in each KVM. That can be used in the shared flow and the infomration can be extracted then after.

View solution in original post

10 REPLIES 10

Not applicable

I don't see any such tag <MapName> present in KVM policy.

Dynamically configuring KVM name is not possible.

I would suggest you to use one KVM and for each proxy take the proxy name as key and value as a JSON body having multiple key values as you wanted to put in each KVM. That can be used in the shared flow and the infomration can be extracted then after.

You can use the new MapName element which was introduced with Apigee X and also provided in Apigee hybrid, although the Apigee docs don't reflect it.

See the Apigee X docs: https://cloud.google.com/apigee/docs/api-platform/reference/policies/key-value-map-operations-policy...

<KeyValueMapOperations name="KV-get">
    <DisplayName>KV-get</DisplayName>
    <MapName ref="map_name"/>
    <Get assignTo="private.value" index="1">
        <Key>
            <Parameter ref="name"/>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

Thank you @ all for your response. It seems although the tag is there for Apigee X it is not available in older Apigee Edge. We did a similar workaround suggested by @Priyadarshi


It works in older Apigee, it's just not documented.

kvms-helper-rev6-2021-05-03.zip

Kurt, this is Apigee SaaS, is that right? It's not available in OPDK, is that right?

I raised a case in Apigee and they confirmed this is not available in Apigee Edge SAAS and I have personally verified that it does not

You're absolutely right, my test was flawed. I feel so embarrassed.

In Apigee legacy <MapName> element was silently ignored and with no "mapIdentifier", the KVM policy defaults to "kvmap" as per the docs here:

https://docs.apigee.com/api-platform/reference/policies/key-value-map-operations-policy#keyvaluemapo...

I've been burned by the lack of a "mapIdentifier" value in the past, you'd think I would have learned.

Thanks @Soumik Das for setting the record straight.

Now where can I can some humble pie?

Ha Ha !! no worries at all. I think I should have paid more attention to the documentation. It was mentioned that it is Apigee X documentation and not the Apigee Edge.

So can I use mapidentifier in Apigee X. I am not able to fetch values by mentioning mapelement in APIGEEX.

Also can I define multiple map elements in one operation/policy

@dino 

please do not ask new questions in comments on 3-year old threads.  If you have a new question, use the "ask a question" button.