Get catalog metadata

Catalog metadata contains a list of configurations that describe the catalog and its layers. Configuration information about the catalog includes the following metadata:

  • Name
  • HERE Resource Name (HRN)
  • Description
  • Owner
  • Version
  • Layer information

To get catalog metadata:

  1. Create the OlpClientSettings object.

    For instructions, see Create platform client settings.

  2. Create the CatalogClient object with the catalog HRN and platform client settings from step 1.

    olp::dataservice::read::CatalogClient catalog_client(
            olp::client::HRN(kCatalogHRN), client_settings);
    
  3. Create the CatalogRequest object.

    auto request =
    olp::dataservice::read::CatalogRequest();
    
  4. (Optional) Set the needed parameters. For example, to set the billing tag, set the WithBillingTag parameter.

    request.WithBillingTag("MyBillingTag");
    
  5. Call the GetRequest method with the CatalogRequest parameter.

    auto future = catalog_client.GetCatalog(request);
    
  6. Wait for CatalogResponse future.

    olp::dataservice::read::CatalogResponse catalog_response = future.GetFuture().get();
    

The CatalogResponse object holds details of the completed operation and is used to determine operation success and access resultant data:

  • IsSuccessful() – if the operation is successful, returns true. Otherwise, returns false.
  • GetResult()– if the operation is successful, returns the following resultant data: olp::dataservice::read::CatalogResult
  • GetError() – contains error information as a result of an error in the olp::client::ApiError object.
if (catalog_response.IsSuccessful()) {
    auto response_result =
        catalog_response.GetResult();
    // Handle success
} else {
    auto api_error = catalog_response.GetError();
    // Handle fail
}

results matching ""

    No results matching ""