Reference documentation and code samples for the Google Cloud Dataplex V1 Client class MetadataServiceClient.
Service Description: Metadata service manages metadata resources such as tables, filesets and partitions.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
This class is currently experimental and may be subject to changes. See Google\Cloud\Dataplex\V1\MetadataServiceClient for the stable implementation
Namespace
Google \ Cloud \ Dataplex \ V1 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
createEntity
Create a metadata entity.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::createEntityAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\CreateEntityRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Dataplex\V1\Entity |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\CreateEntityRequest;
use Google\Cloud\Dataplex\V1\Entity;
use Google\Cloud\Dataplex\V1\Entity\Type;
use Google\Cloud\Dataplex\V1\Schema;
use Google\Cloud\Dataplex\V1\StorageFormat;
use Google\Cloud\Dataplex\V1\StorageSystem;
/**
* @param string $formattedParent The resource name of the parent zone:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`. Please see
* {@see MetadataServiceClient::zoneName()} for help formatting this field.
* @param string $entityId A user-provided entity ID. It is mutable, and will be used as the
* published table name. Specifying a new ID in an update entity
* request will override the existing value.
* The ID must contain only letters (a-z, A-Z), numbers (0-9), and
* underscores, and consist of 256 or fewer characters.
* @param int $entityType Immutable. The type of entity.
* @param string $entityAsset Immutable. The ID of the asset associated with the storage
* location containing the entity data. The entity must be with in the same
* zone with the asset.
* @param string $entityDataPath Immutable. The storage path of the entity data.
* For Cloud Storage data, this is the fully-qualified path to the entity,
* such as `gs://bucket/path/to/data`. For BigQuery data, this is the name of
* the table resource, such as
* `projects/project_id/datasets/dataset_id/tables/table_id`.
* @param int $entitySystem Immutable. Identifies the storage system of the entity data.
* @param string $entityFormatMimeType The mime type descriptor for the data. Must match the pattern
* {type}/{subtype}. Supported values:
*
* - application/x-parquet
* - application/x-avro
* - application/x-orc
* - application/x-tfrecord
* - application/x-parquet+iceberg
* - application/x-avro+iceberg
* - application/x-orc+iceberg
* - application/json
* - application/{subtypes}
* - text/csv
* - text/<subtypes>
* - image/{image subtype}
* - video/{video subtype}
* - audio/{audio subtype}
* @param bool $entitySchemaUserManaged Set to `true` if user-managed or `false` if managed by Dataplex.
* The default is `false` (managed by Dataplex).
*
* - Set to `false`to enable Dataplex discovery to update the schema.
* including new data discovery, schema inference, and schema evolution.
* Users retain the ability to input and edit the schema. Dataplex
* treats schema input by the user as though produced
* by a previous Dataplex discovery operation, and it will
* evolve the schema and take action based on that treatment.
*
* - Set to `true` to fully manage the entity
* schema. This setting guarantees that Dataplex will not
* change schema fields.
*/
function create_entity_sample(
string $formattedParent,
string $entityId,
int $entityType,
string $entityAsset,
string $entityDataPath,
int $entitySystem,
string $entityFormatMimeType,
bool $entitySchemaUserManaged
): void {
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$entityFormat = (new StorageFormat())
->setMimeType($entityFormatMimeType);
$entitySchema = (new Schema())
->setUserManaged($entitySchemaUserManaged);
$entity = (new Entity())
->setId($entityId)
->setType($entityType)
->setAsset($entityAsset)
->setDataPath($entityDataPath)
->setSystem($entitySystem)
->setFormat($entityFormat)
->setSchema($entitySchema);
$request = (new CreateEntityRequest())
->setParent($formattedParent)
->setEntity($entity);
// Call the API and handle any network failures.
try {
/** @var Entity $response */
$response = $metadataServiceClient->createEntity($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = MetadataServiceClient::zoneName('[PROJECT]', '[LOCATION]', '[LAKE]', '[ZONE]');
$entityId = '[ID]';
$entityType = Type::TYPE_UNSPECIFIED;
$entityAsset = '[ASSET]';
$entityDataPath = '[DATA_PATH]';
$entitySystem = StorageSystem::STORAGE_SYSTEM_UNSPECIFIED;
$entityFormatMimeType = '[MIME_TYPE]';
$entitySchemaUserManaged = false;
create_entity_sample(
$formattedParent,
$entityId,
$entityType,
$entityAsset,
$entityDataPath,
$entitySystem,
$entityFormatMimeType,
$entitySchemaUserManaged
);
}
createPartition
Create a metadata partition.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::createPartitionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\CreatePartitionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Dataplex\V1\Partition |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\CreatePartitionRequest;
use Google\Cloud\Dataplex\V1\Partition;
/**
* @param string $formattedParent The resource name of the parent zone:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`. Please see
* {@see MetadataServiceClient::entityName()} for help formatting this field.
* @param string $partitionValuesElement Immutable. The set of values representing the partition, which
* correspond to the partition schema defined in the parent entity.
* @param string $partitionLocation Immutable. The location of the entity data within the partition,
* for example, `gs://bucket/path/to/entity/key1=value1/key2=value2`. Or
* `projects/<project_id>/datasets/<dataset_id>/tables/<table_id>`
*/
function create_partition_sample(
string $formattedParent,
string $partitionValuesElement,
string $partitionLocation
): void {
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$partitionValues = [$partitionValuesElement,];
$partition = (new Partition())
->setValues($partitionValues)
->setLocation($partitionLocation);
$request = (new CreatePartitionRequest())
->setParent($formattedParent)
->setPartition($partition);
// Call the API and handle any network failures.
try {
/** @var Partition $response */
$response = $metadataServiceClient->createPartition($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = MetadataServiceClient::entityName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]'
);
$partitionValuesElement = '[VALUES]';
$partitionLocation = '[LOCATION]';
create_partition_sample($formattedParent, $partitionValuesElement, $partitionLocation);
}
deleteEntity
Delete a metadata entity.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::deleteEntityAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\DeleteEntityRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\DeleteEntityRequest;
/**
* @param string $formattedName The resource name of the entity:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`. Please see
* {@see MetadataServiceClient::entityName()} for help formatting this field.
* @param string $etag The etag associated with the entity, which can be retrieved with
* a [GetEntity][] request.
*/
function delete_entity_sample(string $formattedName, string $etag): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new DeleteEntityRequest())
->setName($formattedName)
->setEtag($etag);
// Call the API and handle any network failures.
try {
$metadataServiceClient->deleteEntity($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = MetadataServiceClient::entityName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]'
);
$etag = '[ETAG]';
delete_entity_sample($formattedName, $etag);
}
deletePartition
Delete a metadata partition.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::deletePartitionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\DeletePartitionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\DeletePartitionRequest;
/**
* @param string $formattedName The resource name of the partition.
* format:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
* The {partition_value_path} segment consists of an ordered sequence of
* partition values separated by "/". All values must be provided. Please see
* {@see MetadataServiceClient::partitionName()} for help formatting this field.
*/
function delete_partition_sample(string $formattedName): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new DeletePartitionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$metadataServiceClient->deletePartition($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = MetadataServiceClient::partitionName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]',
'[PARTITION]'
);
delete_partition_sample($formattedName);
}
getEntity
Get a metadata entity.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::getEntityAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\GetEntityRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Dataplex\V1\Entity |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\Entity;
use Google\Cloud\Dataplex\V1\GetEntityRequest;
/**
* @param string $formattedName The resource name of the entity:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}.`
* Please see {@see MetadataServiceClient::entityName()} for help formatting this field.
*/
function get_entity_sample(string $formattedName): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new GetEntityRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Entity $response */
$response = $metadataServiceClient->getEntity($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = MetadataServiceClient::entityName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]'
);
get_entity_sample($formattedName);
}
getPartition
Get a metadata partition of an entity.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::getPartitionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\GetPartitionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Dataplex\V1\Partition |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\GetPartitionRequest;
use Google\Cloud\Dataplex\V1\Partition;
/**
* @param string $formattedName The resource name of the partition:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}/partitions/{partition_value_path}`.
* The {partition_value_path} segment consists of an ordered sequence of
* partition values separated by "/". All values must be provided. Please see
* {@see MetadataServiceClient::partitionName()} for help formatting this field.
*/
function get_partition_sample(string $formattedName): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new GetPartitionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Partition $response */
$response = $metadataServiceClient->getPartition($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = MetadataServiceClient::partitionName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]',
'[PARTITION]'
);
get_partition_sample($formattedName);
}
listEntities
List metadata entities in a zone.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::listEntitiesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\ListEntitiesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\Entity;
use Google\Cloud\Dataplex\V1\ListEntitiesRequest;
use Google\Cloud\Dataplex\V1\ListEntitiesRequest\EntityView;
/**
* @param string $formattedParent The resource name of the parent zone:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}`. Please see
* {@see MetadataServiceClient::zoneName()} for help formatting this field.
* @param int $view Specify the entity view to make a partial list request.
*/
function list_entities_sample(string $formattedParent, int $view): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new ListEntitiesRequest())
->setParent($formattedParent)
->setView($view);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $metadataServiceClient->listEntities($request);
/** @var Entity $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = MetadataServiceClient::zoneName('[PROJECT]', '[LOCATION]', '[LAKE]', '[ZONE]');
$view = EntityView::ENTITY_VIEW_UNSPECIFIED;
list_entities_sample($formattedParent, $view);
}
listPartitions
List metadata partitions of an entity.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::listPartitionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\ListPartitionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\ListPartitionsRequest;
use Google\Cloud\Dataplex\V1\Partition;
/**
* @param string $formattedParent The resource name of the parent entity:
* `projects/{project_number}/locations/{location_id}/lakes/{lake_id}/zones/{zone_id}/entities/{entity_id}`. Please see
* {@see MetadataServiceClient::entityName()} for help formatting this field.
*/
function list_partitions_sample(string $formattedParent): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new ListPartitionsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $metadataServiceClient->listPartitions($request);
/** @var Partition $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = MetadataServiceClient::entityName(
'[PROJECT]',
'[LOCATION]',
'[LAKE]',
'[ZONE]',
'[ENTITY]'
);
list_partitions_sample($formattedParent);
}
updateEntity
Update a metadata entity. Only supports full resource update.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::updateEntityAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\UpdateEntityRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Dataplex\V1\Entity |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Dataplex\V1\Entity;
use Google\Cloud\Dataplex\V1\Entity\Type;
use Google\Cloud\Dataplex\V1\Schema;
use Google\Cloud\Dataplex\V1\StorageFormat;
use Google\Cloud\Dataplex\V1\StorageSystem;
use Google\Cloud\Dataplex\V1\UpdateEntityRequest;
/**
* @param string $entityId A user-provided entity ID. It is mutable, and will be used as the
* published table name. Specifying a new ID in an update entity
* request will override the existing value.
* The ID must contain only letters (a-z, A-Z), numbers (0-9), and
* underscores, and consist of 256 or fewer characters.
* @param int $entityType Immutable. The type of entity.
* @param string $entityAsset Immutable. The ID of the asset associated with the storage
* location containing the entity data. The entity must be with in the same
* zone with the asset.
* @param string $entityDataPath Immutable. The storage path of the entity data.
* For Cloud Storage data, this is the fully-qualified path to the entity,
* such as `gs://bucket/path/to/data`. For BigQuery data, this is the name of
* the table resource, such as
* `projects/project_id/datasets/dataset_id/tables/table_id`.
* @param int $entitySystem Immutable. Identifies the storage system of the entity data.
* @param string $entityFormatMimeType The mime type descriptor for the data. Must match the pattern
* {type}/{subtype}. Supported values:
*
* - application/x-parquet
* - application/x-avro
* - application/x-orc
* - application/x-tfrecord
* - application/x-parquet+iceberg
* - application/x-avro+iceberg
* - application/x-orc+iceberg
* - application/json
* - application/{subtypes}
* - text/csv
* - text/<subtypes>
* - image/{image subtype}
* - video/{video subtype}
* - audio/{audio subtype}
* @param bool $entitySchemaUserManaged Set to `true` if user-managed or `false` if managed by Dataplex.
* The default is `false` (managed by Dataplex).
*
* - Set to `false`to enable Dataplex discovery to update the schema.
* including new data discovery, schema inference, and schema evolution.
* Users retain the ability to input and edit the schema. Dataplex
* treats schema input by the user as though produced
* by a previous Dataplex discovery operation, and it will
* evolve the schema and take action based on that treatment.
*
* - Set to `true` to fully manage the entity
* schema. This setting guarantees that Dataplex will not
* change schema fields.
*/
function update_entity_sample(
string $entityId,
int $entityType,
string $entityAsset,
string $entityDataPath,
int $entitySystem,
string $entityFormatMimeType,
bool $entitySchemaUserManaged
): void {
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$entityFormat = (new StorageFormat())
->setMimeType($entityFormatMimeType);
$entitySchema = (new Schema())
->setUserManaged($entitySchemaUserManaged);
$entity = (new Entity())
->setId($entityId)
->setType($entityType)
->setAsset($entityAsset)
->setDataPath($entityDataPath)
->setSystem($entitySystem)
->setFormat($entityFormat)
->setSchema($entitySchema);
$request = (new UpdateEntityRequest())
->setEntity($entity);
// Call the API and handle any network failures.
try {
/** @var Entity $response */
$response = $metadataServiceClient->updateEntity($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$entityId = '[ID]';
$entityType = Type::TYPE_UNSPECIFIED;
$entityAsset = '[ASSET]';
$entityDataPath = '[DATA_PATH]';
$entitySystem = StorageSystem::STORAGE_SYSTEM_UNSPECIFIED;
$entityFormatMimeType = '[MIME_TYPE]';
$entitySchemaUserManaged = false;
update_entity_sample(
$entityId,
$entityType,
$entityAsset,
$entityDataPath,
$entitySystem,
$entityFormatMimeType,
$entitySchemaUserManaged
);
}
getIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::getIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
/**
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $metadataServiceClient->getIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
get_iam_policy_sample($resource);
}
setIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::setIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
/**
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$policy = new Policy();
$request = (new SetIamPolicyRequest())
->setResource($resource)
->setPolicy($policy);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $metadataServiceClient->setIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
set_iam_policy_sample($resource);
}
testIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::testIamPermissionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$permissions = [$permissionsElement,];
$request = (new TestIamPermissionsRequest())
->setResource($resource)
->setPermissions($permissions);
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $metadataServiceClient->testIamPermissions($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
getLocation
Gets information about a location.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::getLocationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function get_location_sample(): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $metadataServiceClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
The async variant is Google\Cloud\Dataplex\V1\Client\MetadataServiceClient::listLocationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dataplex\V1\Client\MetadataServiceClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function list_locations_sample(): void
{
// Create a client.
$metadataServiceClient = new MetadataServiceClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $metadataServiceClient->listLocations($request);
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
createEntityAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\CreateEntityRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createPartitionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\CreatePartitionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteEntityAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\DeleteEntityRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deletePartitionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\DeletePartitionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getEntityAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\GetEntityRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getPartitionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\GetPartitionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listEntitiesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\ListEntitiesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listPartitionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\ListPartitionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateEntityAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Dataplex\V1\UpdateEntityRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
setIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
testIamPermissionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getLocationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listLocationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
static::entityName
Formats a string containing the fully-qualified path to represent a entity resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
lake |
string
|
zone |
string
|
entity |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted entity resource. |
static::partitionName
Formats a string containing the fully-qualified path to represent a partition resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
lake |
string
|
zone |
string
|
entity |
string
|
partition |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted partition resource. |
static::zoneName
Formats a string containing the fully-qualified path to represent a zone resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
lake |
string
|
zone |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted zone resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- entity: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity}
- partition: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity}/partitions/{partition}
- zone: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |