apiKeyValueMapUpload¶
this steps creates an API key value map artifact in the API Portal
Description¶
This steps creates an API key value map artifact in the API Portal using the OData API. Learn more about the SAP API Management API for creating an API key value map artifact here.
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
apiKeyValueMapUpload script: this
piper apiKeyValueMapUpload
With this step you can store one or more key value pairs of data stored in a group called a map or key value map.
To consume the ApiKeyValueMapUpload step, proceed as follows:
- Copy the SAP API management service key from the SAP BTP sub account cockpit, under instance and subscriptions → service API Management, API portal, which was created under apiportal-apiaccess plan.
- Store your service key created for SAP API Management in the Jenkins server as a secret text.
- Create a new Jenkins pipeline designated for the ApiKeyValueMapUpload step.
- Execute the pipeline and validate the step exection results as explained in the blog Integration Suite Piper commands
- Using the ApiKeyValueMapUpload step, you can create a new API key value map in the API portal.
- The ApiKeyValueMapUpload step allows you to prevent command execution in case an API key value map already exists.
- If API key value map already exists, then delete it and execute the piper step again, which will create a new API Key value Map.
- ApiKeyValueMapUpload only supports create operation.
Prerequisites¶
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
apiServiceKey | (yes) | pass via ENV or Jenkins credentials (apimApiServiceKeyCredentialsId ) |
key | yes | |
keyValueMapName | yes | |
script | (yes) | reference to Jenkins main pipeline script |
value | yes | |
verbose | no | activates debug output |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
Details¶
apiServiceKey¶
Service key JSON string to access the API Management Runtime service instance of plan 'api'
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_apiServiceKey (if set) |
Secret | yes |
Configuration scope |
|
Resource references | Jenkins credential id: id: apimApiServiceKeyCredentialsId reference to: apiServiceKey |
key¶
Specifies API key name of API key value map
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_key (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
keyValueMapName¶
Specifies the name of the API key value map
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_keyValueMapName (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
script¶
Jenkins-specific: Used for proper environment setup.
The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this
parameter, as in script: this
. This allows the function to access the commonPipelineEnvironment
for retrieving, e.g. configuration parameters.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
value¶
Specifies API key value of API key value map
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_value (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
apimApiServiceKeyCredentialsId¶
Jenkins-specific: Used for proper environment setup. See using credentials for details.
Jenkins secret text credential ID containing the service key to the API Management Runtime service instance of plan 'api'
Scope | Details |
---|---|
Aliases | - |
Type | string |
Configuration scope |
|
Example¶
Configuration example for a Jenkinsfile
:
apiKeyValueMapUpload script: this
Configuration example for a YAML file(for example .pipeline/config.yaml
):
steps:
<...>
apiKeyValueMapUpload:
apimApiServiceKeyCredentialsId: 'MY_API_SERVICE_KEY'
key: API_KEY_NAME
value: API_KEY_VALUE
keyValueMapName: API_KEY_VALUE_MAP_NAME