Google\Cloud\Logging\V2\MetricsServiceV2Client::listLogMetrics PHP Method

listLogMetrics() public method

Sample code: try { $metricsServiceV2Client = new MetricsServiceV2Client(); $formattedParent = MetricsServiceV2Client::formatProjectName("[PROJECT]"); foreach ($metricsServiceV2Client->listLogMetrics($formattedParent) as $element) { doThingsWith(element); } } finally { if (isset($metricsServiceV2Client)) { $metricsServiceV2Client->close(); } }
public listLogMetrics ( string $parent, array $optionalArgs = [] ) : Google\GAX\PagedListResponse
$parent string Required. The name of the project containing the metrics: "projects/[PROJECT_ID]"
$optionalArgs array { Optional. @type string $pageToken A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. @type int $pageSize The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. @type \Google\GAX\RetrySettings $retrySettings Retry settings to use for this call. If present, then $timeoutMillis is ignored. @type int $timeoutMillis Timeout to use for this call. Only used if $retrySettings is not set. }
return Google\GAX\PagedListResponse
    public function listLogMetrics($parent, $optionalArgs = [])
    {
        $request = new ListLogMetricsRequest();
        $request->setParent($parent);
        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }
        $mergedSettings = $this->defaultCallSettings['listLogMetrics']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->metricsServiceV2Stub, 'ListLogMetrics', $mergedSettings, $this->descriptors['listLogMetrics']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }