/**
  * Deletes a logs-based metric.
  *
  * Sample code:
  * ```
  * try {
  *     $metricsServiceV2Api = new MetricsServiceV2Api();
  *     $formattedMetricName = MetricsServiceV2Api::formatMetricName("[PROJECT]", "[METRIC]");
  *     $metricsServiceV2Api->deleteLogMetric($formattedMetricName);
  * } finally {
  *     if (isset($metricsServiceV2Api)) {
  *         $metricsServiceV2Api->close();
  *     }
  * }
  * ```
  *
  * @param string $metricName   The resource name of the metric to delete.
  *                             Example: `"projects/my-project-id/metrics/my-metric-id"`.
  * @param array  $optionalArgs {
  *                             Optional.
  *
  *     @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.
  * }
  *
  * @throws Google\GAX\ApiException if the remote call fails
  */
 public function deleteLogMetric($metricName, $optionalArgs = [])
 {
     $request = new DeleteLogMetricRequest();
     $request->setMetricName($metricName);
     $mergedSettings = $this->defaultCallSettings['deleteLogMetric']->merge(new CallSettings($optionalArgs));
     $callable = ApiCallable::createApiCall($this->stub, 'DeleteLogMetric', $mergedSettings, $this->descriptors['deleteLogMetric']);
     return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
 }
示例#2
0
 /**
  * Returns permissions that a caller has on the specified resource.
  *
  * Sample code:
  * ```
  * try {
  *     $subscriberApi = new SubscriberApi();
  *     $formattedResource = SubscriberApi::formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]");
  *     $permissions = [];
  *     $response = $subscriberApi->testIamPermissions($formattedResource, $permissions);
  * } finally {
  *     if (isset($subscriberApi)) {
  *         $subscriberApi->close();
  *     }
  * }
  * ```
  *
  * @param string   $resource     REQUIRED: The resource for which policy detail is being requested.
  *                               Resource is usually specified as a path, such as, projects/{project}.
  * @param string[] $permissions  The set of permissions to check for the 'resource'. Permissions with
  *                               wildcards (such as '*' or 'storage.*') are not allowed.
  * @param array    $optionalArgs {
  *                               Optional.
  *
  *     @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\iam\v1\TestIamPermissionsResponse
  *
  * @throws Google\GAX\ApiException if the remote call fails
  */
 public function testIamPermissions($resource, $permissions, $optionalArgs = [])
 {
     $request = new TestIamPermissionsRequest();
     $request->setResource($resource);
     foreach ($permissions as $elem) {
         $request->addPermissions($elem);
     }
     $mergedSettings = $this->defaultCallSettings['testIamPermissions']->merge(new CallSettings($optionalArgs));
     $callable = ApiCallable::createApiCall($this->iAMPolicyStub, 'TestIamPermissions', $mergedSettings, $this->descriptors['testIamPermissions']);
     return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
 }
 /**
  * Lists the monitored resource descriptors used by Stackdriver Logging.
  *
  * Sample code:
  * ```
  * try {
  *     $loggingServiceV2Api = new LoggingServiceV2Api();
  *
  *     foreach ($loggingServiceV2Api->listMonitoredResourceDescriptors() as $element) {
  *         // doThingsWith(element);
  *     }
  * } finally {
  *     if (isset($loggingServiceV2Api)) {
  *         $loggingServiceV2Api->close();
  *     }
  * }
  * ```
  *
  * @param array $optionalArgs {
  *                            Optional.
  *
  *     @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 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 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
  *
  * @throws Google\GAX\ApiException if the remote call fails
  */
 public function listMonitoredResourceDescriptors($optionalArgs = [])
 {
     $request = new ListMonitoredResourceDescriptorsRequest();
     if (isset($optionalArgs['pageSize'])) {
         $request->setPageSize($optionalArgs['pageSize']);
     }
     if (isset($optionalArgs['pageToken'])) {
         $request->setPageToken($optionalArgs['pageToken']);
     }
     $mergedSettings = $this->defaultCallSettings['listMonitoredResourceDescriptors']->merge(new CallSettings($optionalArgs));
     $callable = ApiCallable::createApiCall($this->stub, 'ListMonitoredResourceDescriptors', $mergedSettings, $this->descriptors['listMonitoredResourceDescriptors']);
     return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
 }
 /**
  * Deletes a sink.
  *
  * Sample code:
  * ```
  * try {
  *     $configServiceV2Client = new ConfigServiceV2Client();
  *     $formattedSinkName = ConfigServiceV2Client::formatSinkName("[PROJECT]", "[SINK]");
  *     $configServiceV2Client->deleteSink($formattedSinkName);
  * } finally {
  *     if (isset($configServiceV2Client)) {
  *         $configServiceV2Client->close();
  *     }
  * }
  * ```
  *
  * @param string $sinkName Required. The resource name of the sink to delete, including the parent
  *                         resource and the sink identifier:
  *
  *     "projects/[PROJECT_ID]/sinks/[SINK_ID]"
  *     "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
  *
  * It is an error if the sink does not exist.
  * @param array $optionalArgs {
  *                            Optional.
  *
  *     @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.
  * }
  *
  * @throws \Google\GAX\ApiException if the remote call fails
  */
 public function deleteSink($sinkName, $optionalArgs = [])
 {
     $request = new DeleteSinkRequest();
     $request->setSinkName($sinkName);
     $mergedSettings = $this->defaultCallSettings['deleteSink']->merge(new CallSettings($optionalArgs));
     $callable = ApiCallable::createApiCall($this->configServiceV2Stub, 'DeleteSink', $mergedSettings, $this->descriptors['deleteSink']);
     return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
 }