Google\Cloud\Logging\V2\ConfigServiceV2Client::createSink PHP 메소드

createSink() 공개 메소드

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. }
리턴 google\logging\v2\LogSink
    public function createSink($parent, $sink, $optionalArgs = [])
    {
        $request = new CreateSinkRequest();
        $request->setParent($parent);
        $request->setSink($sink);
        if (isset($optionalArgs['uniqueWriterIdentity'])) {
            $request->setUniqueWriterIdentity($optionalArgs['uniqueWriterIdentity']);
        }
        $mergedSettings = $this->defaultCallSettings['createSink']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->configServiceV2Stub, 'CreateSink', $mergedSettings, $this->descriptors['createSink']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }