PHP Class Google\Cloud\Logging\V2\ConfigServiceV2Client

EXPERIMENTAL: this client library class has not yet been declared beta. This class may change more frequently than those which have been declared beta or 1.0, including changes which break backwards compatibility. This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedParent = ConfigServiceV2Client::formatProjectName("[PROJECT]"); foreach ($configServiceV2Client->listSinks($formattedParent) as $element) { doThingsWith(element); } } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } } 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 parse method to extract the individual identifiers contained within names that are returned.
Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php

Public Methods

Method Description
__construct ( array $options = [] ) Constructor.
close ( ) Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.
createSink ( string $parent, google\logging\v2\LogSink $sink, array $optionalArgs = [] ) : google\logging\v2\LogSink Creates a sink.
deleteSink ( string $sinkName, array $optionalArgs = [] ) Deletes a sink.
formatProjectName ( $project ) Formats a string containing the fully-qualified path to represent a project resource.
formatSinkName ( $project, $sink ) Formats a string containing the fully-qualified path to represent a sink resource.
getSink ( string $sinkName, array $optionalArgs = [] ) : google\logging\v2\LogSink Gets a sink.
listSinks ( string $parent, array $optionalArgs = [] ) : Google\GAX\PagedListResponse Lists sinks.
parseProjectFromProjectName ( $projectName ) Parses the project from the given fully-qualified path which represents a project resource.
parseProjectFromSinkName ( $sinkName ) Parses the project from the given fully-qualified path which represents a sink resource.
parseSinkFromSinkName ( $sinkName ) Parses the sink from the given fully-qualified path which represents a sink resource.
updateSink ( string $sinkName, google\logging\v2\LogSink $sink, array $optionalArgs = [] ) : google\logging\v2\LogSink Updates or creates a sink.

Private Methods

Method Description
createCredentialsCallback ( )
getPageStreamingDescriptors ( )
getProjectNameTemplate ( )
getSinkNameTemplate ( )

Method Details

__construct() public method

Constructor.
public __construct ( array $options = [] )
$options array { Optional. Options for configuring the service API wrapper. @type string $serviceAddress The domain name of the API remote host. Default 'logging.googleapis.com'. @type mixed $port The port on which to connect to the remote host. Default 443. @type Grpc\ChannelCredentials $sslCreds A `ChannelCredentials` for use with an SSL-enabled channel. Default: a credentials object returned from Grpc\ChannelCredentials::createSsl() @type array $scopes A string array of scopes to use when acquiring credentials. Default the scopes for the Stackdriver Logging API. @type array $retryingOverride An associative array of string => RetryOptions, where the keys are method names (e.g. 'createFoo'), that overrides default retrying settings. A value of null indicates that the method in question should not retry. @type int $timeoutMillis The timeout in milliseconds to use for calls that don't use retries. For calls that use retries, set the timeout in RetryOptions. Default: 30000 (30 seconds) @type string $appName The codename of the calling service. Default 'gax'. @type string $appVersion The version of the calling service. Default: the current version of GAX. @type Google\Auth\CredentialsLoader $credentialsLoader A CredentialsLoader object created using the Google\Auth library. }

close() public method

Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.
public close ( )

createSink() public method

Sample code: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedParent = ConfigServiceV2Client::formatProjectName("[PROJECT]"); $sink = new LogSink(); $response = $configServiceV2Client->createSink($formattedParent, $sink); } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } }
public createSink ( string $parent, google\logging\v2\LogSink $sink, array $optionalArgs = [] ) : google\logging\v2\LogSink
$parent string Required. The resource in which to create the sink: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
$sink google\logging\v2\LogSink Required. The new sink, whose `name` parameter is a sink identifier that is not already in use.
$optionalArgs array { Optional. @type bool $uniqueWriterIdentity Optional. Whether the sink will have a dedicated service account returned in the sink's writer_identity. Set this field to be true to export logs from one project to a different project. This field is ignored for non-project sinks (e.g. organization sinks) because those sinks are required to have dedicated service accounts. @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\logging\v2\LogSink

deleteSink() public method

Sample code: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedSinkName = ConfigServiceV2Client::formatSinkName("[PROJECT]", "[SINK]"); $configServiceV2Client->deleteSink($formattedSinkName); } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } }
public deleteSink ( string $sinkName, array $optionalArgs = [] )
$sinkName string 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.
$optionalArgs array { 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. }

formatProjectName() public static method

Formats a string containing the fully-qualified path to represent a project resource.
public static formatProjectName ( $project )

formatSinkName() public static method

Formats a string containing the fully-qualified path to represent a sink resource.
public static formatSinkName ( $project, $sink )

getSink() public method

Sample code: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedSinkName = ConfigServiceV2Client::formatSinkName("[PROJECT]", "[SINK]"); $response = $configServiceV2Client->getSink($formattedSinkName); } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } }
public getSink ( string $sinkName, array $optionalArgs = [] ) : google\logging\v2\LogSink
$sinkName string Required. The resource name of the sink to return: "projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
$optionalArgs array { 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\logging\v2\LogSink

listSinks() public method

Sample code: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedParent = ConfigServiceV2Client::formatProjectName("[PROJECT]"); foreach ($configServiceV2Client->listSinks($formattedParent) as $element) { doThingsWith(element); } } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } }
public listSinks ( string $parent, array $optionalArgs = [] ) : Google\GAX\PagedListResponse
$parent string Required. The resource name where this sink was created: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_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

parseProjectFromProjectName() public static method

Parses the project from the given fully-qualified path which represents a project resource.
public static parseProjectFromProjectName ( $projectName )

parseProjectFromSinkName() public static method

Parses the project from the given fully-qualified path which represents a sink resource.
public static parseProjectFromSinkName ( $sinkName )

parseSinkFromSinkName() public static method

Parses the sink from the given fully-qualified path which represents a sink resource.
public static parseSinkFromSinkName ( $sinkName )

updateSink() public method

Sample code: try { $configServiceV2Client = new ConfigServiceV2Client(); $formattedSinkName = ConfigServiceV2Client::formatSinkName("[PROJECT]", "[SINK]"); $sink = new LogSink(); $response = $configServiceV2Client->updateSink($formattedSinkName, $sink); } finally { if (isset($configServiceV2Client)) { $configServiceV2Client->close(); } }
public updateSink ( string $sinkName, google\logging\v2\LogSink $sink, array $optionalArgs = [] ) : google\logging\v2\LogSink
$sinkName string Required. The resource name of the sink to update, including the parent resource and the sink identifier: "projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" Example: `"projects/my-project-id/sinks/my-sink-id"`.
$sink google\logging\v2\LogSink Required. The updated sink, whose name is the same identifier that appears as part of `sinkName`. If `sinkName` does not exist, then this method creates a new sink.
$optionalArgs array { Optional. @type bool $uniqueWriterIdentity Optional. Whether the sink will have a dedicated service account returned in the sink's writer_identity. Set this field to be true to export logs from one project to a different project. This field is ignored for non-project sinks (e.g. organization sinks) because those sinks are required to have dedicated service accounts. @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\logging\v2\LogSink