async function main(projectId, parameterId) {
  // [START parametermanager_list_param_versions]
  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  // const projectId = 'my-project';
  // const parameterId = 'my-parameter';

  // Imports the Parameter Manager library
  const {ParameterManagerClient} = require('@google-cloud/parametermanager');

  // Instantiates a client
  const client = new ParameterManagerClient();

  async function listParamVersions() {
    // Construct the parent string for listing parameter versions globally
    const parent = client.parameterPath(projectId, 'global', parameterId);

    const request = {
      parent: parent,
    };

    // Use listParameterVersionsAsync to handle pagination automatically
    const parameterVersions = await client.listParameterVersionsAsync(request);

    for await (const version of parameterVersions) {
      console.log(
        `Found parameter version ${version.name} with state ${version.disabled ? 'disabled' : 'enabled'}`
      );
    }
    return parameterVersions;
  }

  return await listParamVersions();
  // [END parametermanager_list_param_versions]
}
Lists all versions of an existing parameter in the global location
of the specified project using the Google Cloud Parameter Manager SDK.

@param {string} projectId - The Google Cloud project ID where parameter is located.
@param {string} parameterId - The parameter ID for which versions are to be listed.