Skip to main content

Actions

The ballerinax/aws.marketplace.mpe package exposes the following clients:

Available clients:

ClientPurpose
ClientQuery the AWS Marketplace Entitlement Service to retrieve and filter customer entitlements by product code, customer identifier, or pricing dimension

Client

AWS Marketplace Entitlement service client for querying customer entitlements for AWS Marketplace products.

Configuration

ConnectionConfig

FieldTypeDefaultDescription
authauth:AuthConfigRequiredAuthentication configuration: Any standard credential source supported by aws.auth package: StaticAuthConfig, ProfileAuthConfig, AssumeRoleConfig, WebIdentityConfig, SsoAuthConfig, ProcessAuthConfig, DEFAULT_CREDENTIALS
regionaws:Region|stringRequiredThe AWS region for the Marketplace Entitlement Service endpoint (e.g., aws:US_EAST_1).
endpointaws:EndpointConfigOptionalOptional endpoint options: FIPS/dualstack variants, or a custom endpoint override (e.g. LocalStack, VPC interface endpoints).

Initializing the client

import ballerinax/aws;
import ballerinax/aws.marketplace.mpe;

configurable string accessKeyId = ?;
configurable string secretAccessKey = ?;

mpe:ConnectionConfig config = {
region: aws:US_EAST_1,
auth: {
accessKeyId,
secretAccessKey
}
};
mpe:Client mpeClient = check new (config);

Operations

Entitlements

getEntitlements

Retrieves the entitlement values for a given product, with optional filtering by customer identifier or dimension and pagination support.

Parameters:

NameTypeRequiredDescription
productCodestringYesProduct code used to uniquely identify a product in AWS Marketplace (1–255 characters).
filterEntitlementFilterNoA filter to narrow results by customer identifier (customerIdentifier string array) or product dimension (dimension string array).
maxResultsintNoThe maximum number of results to return in a single call.
nextTokenstringNoThe token for pagination to retrieve the next set of results.

Returns: EntitlementsResponse|Error

Sample code:

mpe:EntitlementsResponse response = check mpeClient->getEntitlements(productCode = "abc123def456");

Sample response:

{
"entitlements": [
{
"productCode": "abc123def456",
"dimension": "users",
"customerIdentifier": "CUST-abcdef123456",
"expirationDate": [1735689600, 0],
"value": 10
}
]
}

Filtered queries

getEntitlements (filtered by customer)

Retrieves entitlements filtered by a specific customer identifier.

Parameters:

NameTypeRequiredDescription
productCodestringYesThe AWS Marketplace product code.
filterEntitlementFilterYesFilter containing customerIdentifier array to filter by specific customers.

Returns: EntitlementsResponse|Error

Sample code:

mpe:EntitlementsResponse response = check mpeClient->getEntitlements(
productCode = "abc123def456",
filter = {
customerIdentifier: ["CUST-abcdef123456"]
}
);

Sample response:

{
"entitlements": [
{
"productCode": "abc123def456",
"dimension": "users",
"customerIdentifier": "CUST-abcdef123456",
"expirationDate": [1735689600, 0],
"value": 10
},
{
"productCode": "abc123def456",
"dimension": "storage_gb",
"customerIdentifier": "CUST-abcdef123456",
"expirationDate": [1735689600, 0],
"value": 50
}
],
"nextToken": null
}

Client lifecycle

close

Closes the AWS MPE client and releases associated resources.

Returns: Error?

Sample code:

check mpeClient.close();