def main()

in managed-entitlements/src/managed_entitlements_sample.py [0:0]


def main(command_line=None):
    print("Start of the sample model 1")
    model1_license_name = "TestLicense1"
    model1_product_sku = "TestProductSKU1"
    model1_entitlement_key = "Users"
    model1_entitlement_count = 1000
    model1_entitlement_unit = "Count"
    model1_entitlement_value = "1"
    model1_source_version = "1"

    client = boto3.client("sts")
    account_id = client.get_caller_identity()["Account"]

    model1_keyfingerprint = f"aws:{account_id}:My Company:issuer-fingerprint"

    product_key_entitlement=[{
     "Name": model1_entitlement_key,
     "Unit": model1_entitlement_unit,
     "MaxCount": model1_entitlement_count,
     "AllowCheckIn": True
     }]

    # Creating a test license for a sample product
    license = create_license(model1_license_name, model1_product_sku,product_key_entitlement)

    # Get the test license details.
    get_license(license['LicenseArn'])

    # Checkout the test license with valid Entitlements.
    checkout_response = checkout_license(model1_keyfingerprint, model1_product_sku, model1_entitlement_key, model1_entitlement_unit, model1_entitlement_value)

    # Extend the test license consumption.
    extend_license_consumption(checkout_response['LicenseConsumptionToken'])

    # Check in the test license
    check_in_license(checkout_response['LicenseConsumptionToken'])

    # Delete the license.
    delete_license(license['LicenseArn'], model1_source_version)