Reference documentation and code samples for the Google Cloud Chronicle V1 Client class NativeDashboardServiceClient.
Service Description: A service providing functionality for managing native dashboards.
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.
Namespace
Google \ Cloud \ Chronicle \ V1 \ ClientMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
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 |
FetchAuthTokenInterface|CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly |
↳ 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. |
↳ logger |
false|LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
↳ universeDomain |
string
The service domain for the client. Defaults to 'googleapis.com'. |
addChart
Add chart in a dashboard.
The async variant is NativeDashboardServiceClient::addChartAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\AddChartRequest
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\Chronicle\V1\AddChartResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\AddChartRequest;
use Google\Cloud\Chronicle\V1\AddChartResponse;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\DashboardChart;
use Google\Cloud\Chronicle\V1\DashboardChart\Visualization;
use Google\Cloud\Chronicle\V1\DashboardDefinition\ChartConfig\ChartLayout;
/**
* @param string $formattedName The dashboard name to add chart in.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
* @param string $dashboardChartDisplayName Display name/Title of the dashboardChart visible to users.
*/
function add_chart_sample(string $formattedName, string $dashboardChartDisplayName): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$dashboardChartVisualization = new Visualization();
$dashboardChart = (new DashboardChart())
->setDisplayName($dashboardChartDisplayName)
->setVisualization($dashboardChartVisualization);
$chartLayout = new ChartLayout();
$request = (new AddChartRequest())
->setName($formattedName)
->setDashboardChart($dashboardChart)
->setChartLayout($chartLayout);
// Call the API and handle any network failures.
try {
/** @var AddChartResponse $response */
$response = $nativeDashboardServiceClient->addChart($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
$dashboardChartDisplayName = '[DISPLAY_NAME]';
add_chart_sample($formattedName, $dashboardChartDisplayName);
}
createNativeDashboard
Create a dashboard.
The async variant is NativeDashboardServiceClient::createNativeDashboardAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\CreateNativeDashboardRequest
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\Chronicle\V1\NativeDashboard |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\CreateNativeDashboardRequest;
use Google\Cloud\Chronicle\V1\NativeDashboard;
/**
* @param string $formattedParent The parent resource where this dashboard will be created.
* Format: projects/{project}/locations/{location}/instances/{instance}
* Please see {@see NativeDashboardServiceClient::instanceName()} for help formatting this field.
* @param string $nativeDashboardDisplayName Dashboard display name/title visible to users.
*/
function create_native_dashboard_sample(
string $formattedParent,
string $nativeDashboardDisplayName
): void {
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$nativeDashboard = (new NativeDashboard())
->setDisplayName($nativeDashboardDisplayName);
$request = (new CreateNativeDashboardRequest())
->setParent($formattedParent)
->setNativeDashboard($nativeDashboard);
// Call the API and handle any network failures.
try {
/** @var NativeDashboard $response */
$response = $nativeDashboardServiceClient->createNativeDashboard($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 = NativeDashboardServiceClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]'
);
$nativeDashboardDisplayName = '[DISPLAY_NAME]';
create_native_dashboard_sample($formattedParent, $nativeDashboardDisplayName);
}
deleteNativeDashboard
Delete a dashboard.
The async variant is NativeDashboardServiceClient::deleteNativeDashboardAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DeleteNativeDashboardRequest
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\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\DeleteNativeDashboardRequest;
/**
* @param string $formattedName The dashboard name to delete.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
*/
function delete_native_dashboard_sample(string $formattedName): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$request = (new DeleteNativeDashboardRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$nativeDashboardServiceClient->deleteNativeDashboard($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
delete_native_dashboard_sample($formattedName);
}
duplicateChart
Duplicate chart in a dashboard.
The async variant is NativeDashboardServiceClient::duplicateChartAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DuplicateChartRequest
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\Chronicle\V1\DuplicateChartResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\DuplicateChartRequest;
use Google\Cloud\Chronicle\V1\DuplicateChartResponse;
/**
* @param string $formattedName The dashboard name that involves chart duplication.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
* @param string $formattedDashboardChart The dashboard chart name to duplicate. Please see
* {@see NativeDashboardServiceClient::dashboardChartName()} for help formatting this field.
*/
function duplicate_chart_sample(string $formattedName, string $formattedDashboardChart): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$request = (new DuplicateChartRequest())
->setName($formattedName)
->setDashboardChart($formattedDashboardChart);
// Call the API and handle any network failures.
try {
/** @var DuplicateChartResponse $response */
$response = $nativeDashboardServiceClient->duplicateChart($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
$formattedDashboardChart = NativeDashboardServiceClient::dashboardChartName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[CHART]'
);
duplicate_chart_sample($formattedName, $formattedDashboardChart);
}
duplicateNativeDashboard
Duplicate a dashboard.
The async variant is NativeDashboardServiceClient::duplicateNativeDashboardAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DuplicateNativeDashboardRequest
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\Chronicle\V1\NativeDashboard |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\DuplicateNativeDashboardRequest;
use Google\Cloud\Chronicle\V1\NativeDashboard;
/**
* @param string $formattedName The dashboard name to duplicate.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
* @param string $nativeDashboardDisplayName Dashboard display name/title visible to users.
*/
function duplicate_native_dashboard_sample(
string $formattedName,
string $nativeDashboardDisplayName
): void {
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$nativeDashboard = (new NativeDashboard())
->setDisplayName($nativeDashboardDisplayName);
$request = (new DuplicateNativeDashboardRequest())
->setName($formattedName)
->setNativeDashboard($nativeDashboard);
// Call the API and handle any network failures.
try {
/** @var NativeDashboard $response */
$response = $nativeDashboardServiceClient->duplicateNativeDashboard($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
$nativeDashboardDisplayName = '[DISPLAY_NAME]';
duplicate_native_dashboard_sample($formattedName, $nativeDashboardDisplayName);
}
editChart
Edit chart in a dashboard.
The async variant is NativeDashboardServiceClient::editChartAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\EditChartRequest
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\Chronicle\V1\EditChartResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\EditChartRequest;
use Google\Cloud\Chronicle\V1\EditChartResponse;
use Google\Protobuf\FieldMask;
/**
* @param string $formattedName The dashboard name to edit chart in.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
*/
function edit_chart_sample(string $formattedName): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$editMask = new FieldMask();
$request = (new EditChartRequest())
->setName($formattedName)
->setEditMask($editMask);
// Call the API and handle any network failures.
try {
/** @var EditChartResponse $response */
$response = $nativeDashboardServiceClient->editChart($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
edit_chart_sample($formattedName);
}
exportNativeDashboards
Exports the dashboards.
The async variant is NativeDashboardServiceClient::exportNativeDashboardsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ExportNativeDashboardsRequest
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\Chronicle\V1\ExportNativeDashboardsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\ExportNativeDashboardsRequest;
use Google\Cloud\Chronicle\V1\ExportNativeDashboardsResponse;
/**
* @param string $formattedParent The parent resource that the dashboards to be exported belong to.
* Format: projects/{project}/locations/{location}/instances/{instance}
* Please see {@see NativeDashboardServiceClient::instanceName()} for help formatting this field.
* @param string $namesElement The resource names of the dashboards to export.
*/
function export_native_dashboards_sample(string $formattedParent, string $namesElement): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$names = [$namesElement,];
$request = (new ExportNativeDashboardsRequest())
->setParent($formattedParent)
->setNames($names);
// Call the API and handle any network failures.
try {
/** @var ExportNativeDashboardsResponse $response */
$response = $nativeDashboardServiceClient->exportNativeDashboards($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 = NativeDashboardServiceClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]'
);
$namesElement = '[NAMES]';
export_native_dashboards_sample($formattedParent, $namesElement);
}
getNativeDashboard
Get a dashboard.
The async variant is NativeDashboardServiceClient::getNativeDashboardAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\GetNativeDashboardRequest
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\Chronicle\V1\NativeDashboard |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\GetNativeDashboardRequest;
use Google\Cloud\Chronicle\V1\NativeDashboard;
/**
* @param string $formattedName The dashboard name to fetch.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
*/
function get_native_dashboard_sample(string $formattedName): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$request = (new GetNativeDashboardRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var NativeDashboard $response */
$response = $nativeDashboardServiceClient->getNativeDashboard($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
get_native_dashboard_sample($formattedName);
}
importNativeDashboards
Imports the dashboards.
The async variant is NativeDashboardServiceClient::importNativeDashboardsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ImportNativeDashboardsRequest
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\Chronicle\V1\ImportNativeDashboardsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\ImportNativeDashboardsInlineSource;
use Google\Cloud\Chronicle\V1\ImportNativeDashboardsRequest;
use Google\Cloud\Chronicle\V1\ImportNativeDashboardsResponse;
use Google\Cloud\Chronicle\V1\NativeDashboardWithChartsAndQueries;
/**
* @param string $formattedParent The parent resource where this dashboard will be created.
* Format: projects/{project}/locations/{location}/instances/{instance}
* Please see {@see NativeDashboardServiceClient::instanceName()} for help formatting this field.
*/
function import_native_dashboards_sample(string $formattedParent): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$sourceDashboards = [new NativeDashboardWithChartsAndQueries()];
$source = (new ImportNativeDashboardsInlineSource())
->setDashboards($sourceDashboards);
$request = (new ImportNativeDashboardsRequest())
->setParent($formattedParent)
->setSource($source);
// Call the API and handle any network failures.
try {
/** @var ImportNativeDashboardsResponse $response */
$response = $nativeDashboardServiceClient->importNativeDashboards($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 = NativeDashboardServiceClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]'
);
import_native_dashboards_sample($formattedParent);
}
listNativeDashboards
List all dashboards.
The async variant is NativeDashboardServiceClient::listNativeDashboardsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ListNativeDashboardsRequest
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\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\ListNativeDashboardsRequest;
use Google\Cloud\Chronicle\V1\NativeDashboard;
/**
* @param string $formattedParent The parent owning this dashboard collection.
* Format: projects/{project}/locations/{location}/instances/{instance}
* Please see {@see NativeDashboardServiceClient::instanceName()} for help formatting this field.
*/
function list_native_dashboards_sample(string $formattedParent): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$request = (new ListNativeDashboardsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $nativeDashboardServiceClient->listNativeDashboards($request);
/** @var NativeDashboard $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 = NativeDashboardServiceClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]'
);
list_native_dashboards_sample($formattedParent);
}
removeChart
Remove chart from a dashboard.
The async variant is NativeDashboardServiceClient::removeChartAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\RemoveChartRequest
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\Chronicle\V1\NativeDashboard |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\NativeDashboard;
use Google\Cloud\Chronicle\V1\RemoveChartRequest;
/**
* @param string $formattedName The dashboard name to remove chart from.
* Format:
* projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
* Please see {@see NativeDashboardServiceClient::nativeDashboardName()} for help formatting this field.
* @param string $formattedDashboardChart The dashboard chart name to remove. Please see
* {@see NativeDashboardServiceClient::dashboardChartName()} for help formatting this field.
*/
function remove_chart_sample(string $formattedName, string $formattedDashboardChart): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$request = (new RemoveChartRequest())
->setName($formattedName)
->setDashboardChart($formattedDashboardChart);
// Call the API and handle any network failures.
try {
/** @var NativeDashboard $response */
$response = $nativeDashboardServiceClient->removeChart($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 = NativeDashboardServiceClient::nativeDashboardName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DASHBOARD]'
);
$formattedDashboardChart = NativeDashboardServiceClient::dashboardChartName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[CHART]'
);
remove_chart_sample($formattedName, $formattedDashboardChart);
}
updateNativeDashboard
Update a dashboard.
The async variant is NativeDashboardServiceClient::updateNativeDashboardAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\UpdateNativeDashboardRequest
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\Chronicle\V1\NativeDashboard |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\NativeDashboardServiceClient;
use Google\Cloud\Chronicle\V1\NativeDashboard;
use Google\Cloud\Chronicle\V1\UpdateNativeDashboardRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $nativeDashboardDisplayName Dashboard display name/title visible to users.
*/
function update_native_dashboard_sample(string $nativeDashboardDisplayName): void
{
// Create a client.
$nativeDashboardServiceClient = new NativeDashboardServiceClient();
// Prepare the request message.
$nativeDashboard = (new NativeDashboard())
->setDisplayName($nativeDashboardDisplayName);
$updateMask = new FieldMask();
$request = (new UpdateNativeDashboardRequest())
->setNativeDashboard($nativeDashboard)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var NativeDashboard $response */
$response = $nativeDashboardServiceClient->updateNativeDashboard($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
{
$nativeDashboardDisplayName = '[DISPLAY_NAME]';
update_native_dashboard_sample($nativeDashboardDisplayName);
}
addChartAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\AddChartRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\AddChartResponse> |
|
createNativeDashboardAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\CreateNativeDashboardRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\NativeDashboard> |
|
deleteNativeDashboardAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DeleteNativeDashboardRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<void> |
|
duplicateChartAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DuplicateChartRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\DuplicateChartResponse> |
|
duplicateNativeDashboardAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\DuplicateNativeDashboardRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\NativeDashboard> |
|
editChartAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\EditChartRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\EditChartResponse> |
|
exportNativeDashboardsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ExportNativeDashboardsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\ExportNativeDashboardsResponse> |
|
getNativeDashboardAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\GetNativeDashboardRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\NativeDashboard> |
|
importNativeDashboardsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ImportNativeDashboardsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\ImportNativeDashboardsResponse> |
|
listNativeDashboardsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\ListNativeDashboardsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
removeChartAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\RemoveChartRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\NativeDashboard> |
|
updateNativeDashboardAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Chronicle\V1\UpdateNativeDashboardRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Chronicle\V1\NativeDashboard> |
|
static::dashboardChartName
Formats a string containing the fully-qualified path to represent a dashboard_chart resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
instance |
string
|
chart |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted dashboard_chart resource. |
static::dashboardQueryName
Formats a string containing the fully-qualified path to represent a dashboard_query resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
instance |
string
|
query |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted dashboard_query resource. |
static::instanceName
Formats a string containing the fully-qualified path to represent a instance resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
instance |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted instance resource. |
static::nativeDashboardName
Formats a string containing the fully-qualified path to represent a native_dashboard resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
instance |
string
|
dashboard |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted native_dashboard 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
- dashboardChart: projects/{project}/locations/{location}/instances/{instance}/dashboardCharts/{chart}
- dashboardQuery: projects/{project}/locations/{location}/instances/{instance}/dashboardQueries/{query}
- instance: projects/{project}/locations/{location}/instances/{instance}
- nativeDashboard: projects/{project}/locations/{location}/instances/{instance}/nativeDashboards/{dashboard}
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. |