_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q15500 | Debuggee.updateBreakpoint | train | public function updateBreakpoint(Breakpoint $breakpoint, array $options = [])
{
$this->connection->updateBreakpoint([
'debuggeeId' => $this->id,
'id' => $breakpoint->id(),
'breakpoint' => $breakpoint->info()
] + $options);
} | php | {
"resource": ""
} |
q15501 | Debuggee.setBreakpoint | train | public function setBreakpoint($path, $line, array $options = [])
{
$resp = $this->connection->setBreakpoint([
'debuggeeId' => $this->id,
'location' => [
'path' => $path,
'line' => $line
]
] + $options);
return new Breakpoint($resp['breakpoint']);
} | php | {
"resource": ""
} |
q15502 | Debuggee.updateBreakpointBatch | train | public function updateBreakpointBatch(array $breakpoints, array $options = [])
{
foreach ($breakpoints as $breakpoint) {
$this->updateBreakpoint($breakpoint, $options);
}
} | php | {
"resource": ""
} |
q15503 | GrpcRequestWrapper.handleResponse | train | private function handleResponse($response)
{
if ($response instanceof PagedListResponse || $response instanceof GaxPagedListResponse) {
$response = $response->getPage()->getResponseObject();
}
if ($response instanceof Message) {
return $this->serializer->encodeMessage($response);
}
if ($response instanceof OperationResponse || $response instanceof GaxOperationResponse) {
return $response;
}
if ($response instanceof ServerStream || $response instanceof GaxServerStream) {
return $this->handleStream($response);
}
return null;
} | php | {
"resource": ""
} |
q15504 | GrpcRequestWrapper.handleStream | train | private function handleStream($response)
{
try {
foreach ($response->readAll() as $count => $result) {
$res = $this->serializer->encodeMessage($result);
yield $res;
}
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
} | php | {
"resource": ""
} |
q15505 | GrpcRequestWrapper.convertToGoogleException | train | private function convertToGoogleException($ex)
{
switch ($ex->getCode()) {
case Code::INVALID_ARGUMENT:
$exception = Exception\BadRequestException::class;
break;
case Code::NOT_FOUND:
case Code::UNIMPLEMENTED:
$exception = Exception\NotFoundException::class;
break;
case Code::ALREADY_EXISTS:
$exception = Exception\ConflictException::class;
break;
case Code::FAILED_PRECONDITION:
$exception = Exception\FailedPreconditionException::class;
break;
case Code::UNKNOWN:
$exception = Exception\ServerException::class;
break;
case Code::INTERNAL:
$exception = Exception\ServerException::class;
break;
case Code::ABORTED:
$exception = Exception\AbortedException::class;
break;
case Code::DEADLINE_EXCEEDED:
$exception = Exception\DeadlineExceededException::class;
break;
default:
$exception = Exception\ServiceException::class;
break;
}
$metadata = [];
if ($ex->getMetadata()) {
foreach ($ex->getMetadata() as $type => $binaryValue) {
if (!isset($this->metadataTypes[$type])) {
continue;
}
$metadataElement = new $this->metadataTypes[$type];
$metadataElement->mergeFromString($binaryValue[0]);
$metadata[] = $this->serializer->encodeMessage($metadataElement);
}
}
return new $exception($ex->getMessage(), $ex->getCode(), $ex, $metadata);
} | php | {
"resource": ""
} |
q15506 | ImageContext.setLatLongRect | train | public function setLatLongRect($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\LatLongRect::class);
$this->lat_long_rect = $var;
return $this;
} | php | {
"resource": ""
} |
q15507 | ImageContext.setCropHintsParams | train | public function setCropHintsParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsParams::class);
$this->crop_hints_params = $var;
return $this;
} | php | {
"resource": ""
} |
q15508 | ImageContext.setProductSearchParams | train | public function setProductSearchParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class);
$this->product_search_params = $var;
return $this;
} | php | {
"resource": ""
} |
q15509 | ImageContext.setWebDetectionParams | train | public function setWebDetectionParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetectionParams::class);
$this->web_detection_params = $var;
return $this;
} | php | {
"resource": ""
} |
q15510 | QueryResultBatch.setEntityResultType | train | public function setEntityResultType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\EntityResult_ResultType::class);
$this->entity_result_type = $var;
return $this;
} | php | {
"resource": ""
} |
q15511 | QueryResultBatch.setEntityResults | train | public function setEntityResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->entity_results = $arr;
return $this;
} | php | {
"resource": ""
} |
q15512 | QueryResultBatch.setMoreResults | train | public function setMoreResults($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\QueryResultBatch_MoreResultsType::class);
$this->more_results = $var;
return $this;
} | php | {
"resource": ""
} |
q15513 | Result.setInfoTypeStats | train | public function setInfoTypeStats($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InfoTypeStats::class);
$this->info_type_stats = $arr;
return $this;
} | php | {
"resource": ""
} |
q15514 | ListMetricDescriptorsResponse.setMetricDescriptors | train | public function setMetricDescriptors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class);
$this->metric_descriptors = $arr;
return $this;
} | php | {
"resource": ""
} |
q15515 | ListProductSetsResponse.setProductSets | train | public function setProductSets($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSet::class);
$this->product_sets = $arr;
return $this;
} | php | {
"resource": ""
} |
q15516 | HttpTarget.setHttpMethod | train | public function setHttpMethod($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Scheduler\V1beta1\HttpMethod::class);
$this->http_method = $var;
return $this;
} | php | {
"resource": ""
} |
q15517 | Value.setKeyValue | train | public function setKeyValue($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Key::class);
$this->writeOneof(5, $var);
return $this;
} | php | {
"resource": ""
} |
q15518 | UpdateAlertPolicyRequest.setAlertPolicy | train | public function setAlertPolicy($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy::class);
$this->alert_policy = $var;
return $this;
} | php | {
"resource": ""
} |
q15519 | FirestoreClient.batch | train | public function batch()
{
return new WriteBatch(
$this->connection,
$this->valueMapper,
$this->databaseName(
$this->projectId,
$this->database
)
);
} | php | {
"resource": ""
} |
q15520 | FirestoreClient.collection | train | public function collection($name)
{
return $this->getCollectionReference(
$this->connection,
$this->valueMapper,
$this->projectId,
$this->database,
$name
);
} | php | {
"resource": ""
} |
q15521 | FirestoreClient.collections | train | public function collections(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($collectionId) {
return $this->collection($collectionId);
},
[$this->connection, 'listCollectionIds'],
[
'parent' => $this->fullName($this->projectId, $this->database),
] + $options,
[
'itemsKey' => 'collectionIds',
'resultLimit' => $resultLimit
]
)
);
} | php | {
"resource": ""
} |
q15522 | FirestoreClient.document | train | public function document($name)
{
return $this->getDocumentReference(
$this->connection,
$this->valueMapper,
$this->projectId,
$this->database,
$name
);
} | php | {
"resource": ""
} |
q15523 | FirestoreClient.runTransaction | train | public function runTransaction(callable $callable, array $options = [])
{
$options += [
'maxRetries' => self::MAX_RETRIES,
'begin' => [],
'commit' => [],
'rollback' => []
];
$retryableErrors = [
AbortedException::class
];
$delayFn = function () {
return [
'seconds' => 0,
'nanos' => 0
];
};
$retryFn = function (\Exception $e) use ($retryableErrors) {
return in_array(get_class($e), $retryableErrors);
};
// Track the Transaction ID outside the retry function.
// If the transaction is retried after an abort, the previous transaction
// must be provided to the subsequent `beginTransaction` rpc.
// It also provides a convenient indication to the user whether the
// transaction is retried or not.
$transactionId = null;
$retry = new Retry($options['maxRetries'], $delayFn, $retryFn);
return $retry->execute(function (
callable $callable,
array $options
) use (&$transactionId) {
$database = $this->databaseName($this->projectId, $this->database);
$beginTransaction = $this->connection->beginTransaction(array_filter([
'database' => $database,
'retryTransaction' => $transactionId
]) + $options['begin']);
$transactionId = $beginTransaction['transaction'];
$transaction = new Transaction(
$this->connection,
$this->valueMapper,
$database,
$transactionId
);
try {
$res = $callable($transaction);
if (!$transaction->writer()->isEmpty()) {
$transaction->writer()->commit([
'transaction' => $transactionId
] + $options['commit']);
} else {
// trigger rollback if no writes exist.
$transaction->writer()->rollback($options['rollback']);
}
return $res;
} catch (\Exception $e) {
$transaction->writer()->rollback($options['rollback']);
throw $e;
}
}, [
$callable,
$options
]);
} | php | {
"resource": ""
} |
q15524 | UpdateFieldRequest.setField | train | public function setField($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Field::class);
$this->field = $var;
return $this;
} | php | {
"resource": ""
} |
q15525 | Mutation.setDelete | train | public function setDelete($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation_Delete::class);
$this->writeOneof(5, $var);
return $this;
} | php | {
"resource": ""
} |
q15526 | SearchUrisResponse.setThreat | train | public function setThreat($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse_ThreatUri::class);
$this->threat = $var;
return $this;
} | php | {
"resource": ""
} |
q15527 | ListTransferConfigsRequest.setDataSourceIds | train | public function setDataSourceIds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->data_source_ids = $arr;
return $this;
} | php | {
"resource": ""
} |
q15528 | ClientTrait.getConnectionType | train | private function getConnectionType(array $config)
{
$isGrpcExtensionLoaded = $this->isGrpcLoaded();
$defaultTransport = $isGrpcExtensionLoaded ? 'grpc' : 'rest';
$transport = isset($config['transport'])
? strtolower($config['transport'])
: $defaultTransport;
if ($transport === 'grpc') {
if (!$isGrpcExtensionLoaded) {
throw new GoogleException(
'gRPC support has been requested but required dependencies ' .
'have not been found. ' . $this->getGrpcInstallationMessage()
);
}
}
return $transport;
} | php | {
"resource": ""
} |
q15529 | ClientTrait.configureAuthentication | train | private function configureAuthentication(array $config)
{
$config['keyFile'] = $this->getKeyFile($config);
$this->projectId = $this->detectProjectId($config);
return $config;
} | php | {
"resource": ""
} |
q15530 | ClientTrait.getKeyFile | train | private function getKeyFile(array $config = [])
{
$config += [
'keyFile' => null,
'keyFilePath' => null,
];
if ($config['keyFile']) {
return $config['keyFile'];
}
if ($config['keyFilePath']) {
if (!file_exists($config['keyFilePath'])) {
throw new GoogleException(sprintf(
'Given keyfile path %s does not exist',
$config['keyFilePath']
));
}
try {
$keyFileData = $this->jsonDecode(file_get_contents($config['keyFilePath']), true);
} catch (\InvalidArgumentException $ex) {
throw new GoogleException(sprintf(
'Given keyfile at path %s was invalid',
$config['keyFilePath']
));
}
return $keyFileData;
}
return CredentialsLoader::fromEnv()
?: CredentialsLoader::fromWellKnownFile();
} | php | {
"resource": ""
} |
q15531 | ClientTrait.detectProjectId | train | private function detectProjectId(array $config)
{
$config += [
'httpHandler' => null,
'projectId' => null,
'projectIdRequired' => false,
'hasEmulator' => false,
'preferNumericProjectId' => false,
'suppressKeyFileNotice' => false
];
if ($config['projectId']) {
return $config['projectId'];
}
if ($config['hasEmulator']) {
return 'emulator-project';
}
if (isset($config['keyFile'])) {
if (isset($config['keyFile']['project_id'])) {
return $config['keyFile']['project_id'];
}
if ($config['suppressKeyFileNotice'] !== true) {
$serviceAccountUri = 'https://cloud.google.com/iam/docs/' .
'creating-managing-service-account-keys#creating_service_account_keys';
trigger_error(
sprintf(
'A keyfile was given, but it does not contain a project ' .
'ID. This can indicate an old and obsolete keyfile, ' .
'in which case you should create a new one. To suppress ' .
'this message, set `suppressKeyFileNotice` to `true` in your client configuration. ' .
'To learn more about generating new keys, see this URL: %s',
$serviceAccountUri
),
E_USER_NOTICE
);
}
}
if (getenv('GOOGLE_CLOUD_PROJECT')) {
return getenv('GOOGLE_CLOUD_PROJECT');
}
if (getenv('GCLOUD_PROJECT')) {
return getenv('GCLOUD_PROJECT');
}
if ($this->onGce($config['httpHandler'])) {
$metadata = $this->getMetaData();
$projectId = $config['preferNumericProjectId']
? $metadata->getNumericProjectId()
: $metadata->getProjectId();
if ($projectId) {
return $projectId;
}
}
if ($config['projectIdRequired']) {
throw new GoogleException(
'No project ID was provided, ' .
'and we were unable to detect a default project ID.'
);
}
} | php | {
"resource": ""
} |
q15532 | AddonsConfig.setHorizontalPodAutoscaling | train | public function setHorizontalPodAutoscaling($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\HorizontalPodAutoscaling::class);
$this->horizontal_pod_autoscaling = $var;
return $this;
} | php | {
"resource": ""
} |
q15533 | AddonsConfig.setKubernetesDashboard | train | public function setKubernetesDashboard($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\KubernetesDashboard::class);
$this->kubernetes_dashboard = $var;
return $this;
} | php | {
"resource": ""
} |
q15534 | AddonsConfig.setNetworkPolicyConfig | train | public function setNetworkPolicyConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\NetworkPolicyConfig::class);
$this->network_policy_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15535 | ListTenantsResponse.setTenants | train | public function setTenants($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Tenant::class);
$this->tenants = $arr;
return $this;
} | php | {
"resource": ""
} |
q15536 | Target.setQuery | train | public function setQuery($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_QueryTarget::class);
$this->writeOneof(2, $var);
return $this;
} | php | {
"resource": ""
} |
q15537 | Target.setDocuments | train | public function setDocuments($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_DocumentsTarget::class);
$this->writeOneof(3, $var);
return $this;
} | php | {
"resource": ""
} |
q15538 | SnapshotTrait.createSnapshot | train | private function createSnapshot(
ConnectionInterface $connection,
ValueMapper $valueMapper,
DocumentReference $reference,
array $options = []
) {
$document = [];
$fields = [];
$exists = true;
try {
$document = $this->getSnapshot($connection, $reference->name(), $options);
} catch (NotFoundException $e) {
$exists = false;
}
return $this->createSnapshotWithData($valueMapper, $reference, $document, $exists);
} | php | {
"resource": ""
} |
q15539 | SnapshotTrait.createSnapshotWithData | train | private function createSnapshotWithData(
ValueMapper $valueMapper,
DocumentReference $reference,
array $document,
$exists = true
) {
$fields = $exists
? $valueMapper->decodeValues($this->pluck('fields', $document))
: [];
$document = $this->transformSnapshotTimestamps($document);
return new DocumentSnapshot($reference, $valueMapper, $document, $fields, $exists);
} | php | {
"resource": ""
} |
q15540 | SnapshotTrait.getSnapshot | train | private function getSnapshot(ConnectionInterface $connection, $name, array $options = [])
{
if (isset($options['readTime'])) {
if (!($options['readTime'] instanceof Timestamp)) {
throw new \InvalidArgumentException(sprintf(
'`$options.readTime` must be an instance of %s',
Timestamp::class
));
}
$options['readTime'] = $options['readTime']->formatForApi();
}
$snapshot = $connection->batchGetDocuments([
'database' => $this->databaseFromName($name),
'documents' => [$name],
] + $options)->current();
if (!isset($snapshot['found'])) {
throw new NotFoundException(sprintf(
'Document %s does not exist',
$name
));
}
return $snapshot['found'];
} | php | {
"resource": ""
} |
q15541 | SnapshotTrait.getDocumentReference | train | private function getDocumentReference(
ConnectionInterface $connection,
ValueMapper $mapper,
$projectId,
$database,
$name
) {
if ($this->isRelative($name)) {
try {
$name = $this->fullName($projectId, $database, $name);
} catch (ValidationException $e) {
// The GAPIC parser does not support special characters in paths,
// but Firestore does. If an exception is raised by the parser,
// we'll check for special characters. If they exist, we'll
// manually construct a document path.
$hasSpecialChars = preg_match('/[!@#$%^&*(),.?":{}|<>]/', $name) === 1;
//@codeCoverageIgnoreStart
if (!$hasSpecialChars) {
throw $e;
}
//@codeCoverageIgnoreEnd
$base = $this->databaseName($projectId, $database);
$name = $base .'/documents/'. $name;
}
}
if (!$this->isDocument($name)) {
throw new \InvalidArgumentException('Given path is not a valid document path.');
}
return new DocumentReference(
$connection,
$mapper,
$this->getCollectionReference(
$connection,
$mapper,
$projectId,
$database,
$this->parentPath($name)
),
$name
);
} | php | {
"resource": ""
} |
q15542 | SnapshotTrait.getCollectionReference | train | private function getCollectionReference(
ConnectionInterface $connection,
ValueMapper $mapper,
$projectId,
$database,
$name
) {
if ($this->isRelative($name)) {
$name = $this->fullName($projectId, $database, $name);
}
if (!$this->isCollection($name)) {
throw new \InvalidArgumentException(sprintf(
'Given path `%s` is not a valid collection path.',
$name
));
}
return new CollectionReference($connection, $mapper, $name);
} | php | {
"resource": ""
} |
q15543 | SnapshotTrait.transformSnapshotTimestamps | train | private function transformSnapshotTimestamps(array $data)
{
foreach (['createTime', 'updateTime', 'readTime'] as $timestampField) {
if (!isset($data[$timestampField])) {
continue;
}
list ($dt, $nanos) = $this->parseTimeString($data[$timestampField]);
$data[$timestampField] = new Timestamp($dt, $nanos);
}
return $data;
} | php | {
"resource": ""
} |
q15544 | ResultSet.setMetadata | train | public function setMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class);
$this->metadata = $var;
return $this;
} | php | {
"resource": ""
} |
q15545 | UpdateInstanceMetadata.setInstance | train | public function setInstance($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class);
$this->instance = $var;
return $this;
} | php | {
"resource": ""
} |
q15546 | UpdateLogMetricRequest.setMetric | train | public function setMetric($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogMetric::class);
$this->metric = $var;
return $this;
} | php | {
"resource": ""
} |
q15547 | ListApplicationsResponse.setApplications | train | public function setApplications($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Application::class);
$this->applications = $arr;
return $this;
} | php | {
"resource": ""
} |
q15548 | Message.setQuickReplies | train | public function setQuickReplies($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_QuickReplies::class);
$this->writeOneof(3, $var);
return $this;
} | php | {
"resource": ""
} |
q15549 | Message.setCard | train | public function setCard($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Card::class);
$this->writeOneof(4, $var);
return $this;
} | php | {
"resource": ""
} |
q15550 | Message.setSimpleResponses | train | public function setSimpleResponses($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_SimpleResponses::class);
$this->writeOneof(7, $var);
return $this;
} | php | {
"resource": ""
} |
q15551 | Message.setBasicCard | train | public function setBasicCard($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_BasicCard::class);
$this->writeOneof(8, $var);
return $this;
} | php | {
"resource": ""
} |
q15552 | Message.setSuggestions | train | public function setSuggestions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Suggestions::class);
$this->writeOneof(9, $var);
return $this;
} | php | {
"resource": ""
} |
q15553 | Message.setLinkOutSuggestion | train | public function setLinkOutSuggestion($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_LinkOutSuggestion::class);
$this->writeOneof(10, $var);
return $this;
} | php | {
"resource": ""
} |
q15554 | Message.setListSelect | train | public function setListSelect($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_ListSelect::class);
$this->writeOneof(11, $var);
return $this;
} | php | {
"resource": ""
} |
q15555 | Message.setCarouselSelect | train | public function setCarouselSelect($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_CarouselSelect::class);
$this->writeOneof(12, $var);
return $this;
} | php | {
"resource": ""
} |
q15556 | Message.setPlatform | train | public function setPlatform($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Platform::class);
$this->platform = $var;
return $this;
} | php | {
"resource": ""
} |
q15557 | ExportDocumentsMetadata.setOperationState | train | public function setOperationState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Firestore\Admin\V1\OperationState::class);
$this->operation_state = $var;
return $this;
} | php | {
"resource": ""
} |
q15558 | ExportDocumentsMetadata.setProgressDocuments | train | public function setProgressDocuments($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class);
$this->progress_documents = $var;
return $this;
} | php | {
"resource": ""
} |
q15559 | ExportDocumentsMetadata.setProgressBytes | train | public function setProgressBytes($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class);
$this->progress_bytes = $var;
return $this;
} | php | {
"resource": ""
} |
q15560 | ExportDocumentsMetadata.setCollectionIds | train | public function setCollectionIds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->collection_ids = $arr;
return $this;
} | php | {
"resource": ""
} |
q15561 | Database.reload | train | public function reload(array $options = [])
{
return $this->info = $this->connection->getDatabase([
'name' => $this->name
] + $options);
} | php | {
"resource": ""
} |
q15562 | Database.create | train | public function create(array $options = [])
{
$options += [
'statements' => [],
];
$databaseId = DatabaseAdminClient::parseName($this->name())['database'];
$statement = sprintf('CREATE DATABASE `%s`', $databaseId);
$operation = $this->connection->createDatabase([
'instance' => $this->instance->name(),
'createStatement' => $statement,
'extraStatements' => $options['statements']
]);
return $this->resumeOperation($operation['name'], $operation);
} | php | {
"resource": ""
} |
q15563 | Database.updateDdlBatch | train | public function updateDdlBatch(array $statements, array $options = [])
{
$operation = $this->connection->updateDatabaseDdl($options + [
'name' => $this->name,
'statements' => $statements,
]);
return $this->resumeOperation($operation['name'], $operation);
} | php | {
"resource": ""
} |
q15564 | Database.drop | train | public function drop(array $options = [])
{
$this->connection->dropDatabase($options + [
'name' => $this->name
]);
if ($this->sessionPool) {
$this->sessionPool->clear();
}
if ($this->session) {
$this->session->delete($options);
$this->session = null;
}
} | php | {
"resource": ""
} |
q15565 | Database.ddl | train | public function ddl(array $options = [])
{
$ddl = $this->connection->getDatabaseDDL($options + [
'name' => $this->name
]);
if (isset($ddl['statements'])) {
return $ddl['statements'];
}
return [];
} | php | {
"resource": ""
} |
q15566 | Database.iam | train | public function iam()
{
if (!$this->iam) {
$this->iam = new Iam(
new IamDatabase($this->connection),
$this->name
);
}
return $this->iam;
} | php | {
"resource": ""
} |
q15567 | Database.snapshot | train | public function snapshot(array $options = [])
{
if ($this->isRunningTransaction) {
throw new \BadMethodCallException('Nested transactions are not supported by this client.');
}
$options += [
'singleUse' => false
];
$options['transactionOptions'] = $this->configureSnapshotOptions($options);
$session = $this->selectSession(
SessionPoolInterface::CONTEXT_READ,
$this->pluck('sessionOptions', $options, false) ?: []
);
try {
return $this->operation->snapshot($session, $options);
} finally {
$session->setExpiration();
}
} | php | {
"resource": ""
} |
q15568 | Database.insertBatch | train | public function insertBatch($table, array $dataSet, array $options = [])
{
$mutations = [];
foreach ($dataSet as $data) {
$mutations[] = $this->operation->mutation(Operation::OP_INSERT, $table, $data);
}
return $this->commitInSingleUseTransaction($mutations, $options);
} | php | {
"resource": ""
} |
q15569 | Database.updateBatch | train | public function updateBatch($table, array $dataSet, array $options = [])
{
$mutations = [];
foreach ($dataSet as $data) {
$mutations[] = $this->operation->mutation(Operation::OP_UPDATE, $table, $data);
}
return $this->commitInSingleUseTransaction($mutations, $options);
} | php | {
"resource": ""
} |
q15570 | Database.insertOrUpdateBatch | train | public function insertOrUpdateBatch($table, array $dataSet, array $options = [])
{
$mutations = [];
foreach ($dataSet as $data) {
$mutations[] = $this->operation->mutation(Operation::OP_INSERT_OR_UPDATE, $table, $data);
}
return $this->commitInSingleUseTransaction($mutations, $options);
} | php | {
"resource": ""
} |
q15571 | Database.replaceBatch | train | public function replaceBatch($table, array $dataSet, array $options = [])
{
$mutations = [];
foreach ($dataSet as $data) {
$mutations[] = $this->operation->mutation(Operation::OP_REPLACE, $table, $data);
}
return $this->commitInSingleUseTransaction($mutations, $options);
} | php | {
"resource": ""
} |
q15572 | Database.delete | train | public function delete($table, KeySet $keySet, array $options = [])
{
$mutations = [$this->operation->deleteMutation($table, $keySet)];
return $this->commitInSingleUseTransaction($mutations, $options);
} | php | {
"resource": ""
} |
q15573 | Database.executePartitionedUpdate | train | public function executePartitionedUpdate($statement, array $options = [])
{
$session = $this->selectSession(SessionPoolInterface::CONTEXT_READWRITE);
$transaction = $this->operation->transaction($session, [
'transactionOptions' => [
'partitionedDml' => []
]
]);
try {
return $this->operation->executeUpdate($session, $transaction, $statement, [
'statsItem' => 'rowCountLowerBound'
] + $options);
} finally {
$session->setExpiration();
}
} | php | {
"resource": ""
} |
q15574 | Database.close | train | public function close()
{
if ($this->session) {
if ($this->sessionPool) {
$this->sessionPool->release($this->session);
} else {
$this->session->delete();
}
$this->session = null;
}
} | php | {
"resource": ""
} |
q15575 | Database.identity | train | public function identity()
{
$databaseParts = explode('/', $this->name);
$instanceParts = explode('/', $this->instance->name());
return [
'projectId' => $this->projectId,
'database' => end($databaseParts),
'instance' => end($instanceParts),
];
} | php | {
"resource": ""
} |
q15576 | Database.selectSession | train | private function selectSession($context = SessionPoolInterface::CONTEXT_READ, array $options = [])
{
if ($this->session) {
return $this->session;
}
if ($this->sessionPool) {
return $this->session = $this->sessionPool->acquire($context);
}
return $this->session = $this->operation->createSession($this->name, $options);
} | php | {
"resource": ""
} |
q15577 | Database.commitInSingleUseTransaction | train | private function commitInSingleUseTransaction(array $mutations, array $options = [])
{
$options['mutations'] = $mutations;
return $this->runTransaction(function (Transaction $t) use ($options) {
return $t->commit($options);
}, [
'singleUse' => true
]);
} | php | {
"resource": ""
} |
q15578 | Database.fullyQualifiedDatabaseName | train | private function fullyQualifiedDatabaseName($name)
{
$instance = InstanceAdminClient::parseName($this->instance->name())['instance'];
try {
return GapicSpannerClient::databaseName(
$this->projectId,
$instance,
$name
);
//@codeCoverageIgnoreStart
} catch (ValidationException $e) {
return $name;
}
//@codeCoverageIgnoreEnd
} | php | {
"resource": ""
} |
q15579 | StreamReader.read | train | public function read($path)
{
$url = self::BASE_URL.$path;
return file_get_contents($url, false, $this->context);
} | php | {
"resource": ""
} |
q15580 | MetadataProviderUtils.autoSelect | train | public static function autoSelect($server)
{
if (isset($server['GAE_SERVICE'])) {
if (isset($server['GAE_ENV']) && $server['GAE_ENV'] === 'standard') {
return new GAEStandardMetadataProvider($server);
}
return new GAEFlexMetadataProvider($server);
}
return new EmptyMetadataProvider();
} | php | {
"resource": ""
} |
q15581 | TransferMessage.setSeverity | train | public function setSeverity($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity::class);
$this->severity = $var;
return $this;
} | php | {
"resource": ""
} |
q15582 | KMapEstimationConfig.setAuxiliaryTables | train | public function setAuxiliaryTables($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\PrivacyMetric\KMapEstimationConfig\AuxiliaryTable::class);
$this->auxiliary_tables = $arr;
return $this;
} | php | {
"resource": ""
} |
q15583 | NodeManagement.setUpgradeOptions | train | public function setUpgradeOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\AutoUpgradeOptions::class);
$this->upgrade_options = $var;
return $this;
} | php | {
"resource": ""
} |
q15584 | ObjectPageIterator.updatePrefixes | train | private function updatePrefixes()
{
foreach ($this->page['prefixes'] as $prefix) {
if (!in_array($prefix, $this->prefixes)) {
$this->prefixes[] = $prefix;
}
}
} | php | {
"resource": ""
} |
q15585 | Job.setPlacement | train | public function setPlacement($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobPlacement::class);
$this->placement = $var;
return $this;
} | php | {
"resource": ""
} |
q15586 | Job.setHiveJob | train | public function setHiveJob($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\HiveJob::class);
$this->writeOneof(6, $var);
return $this;
} | php | {
"resource": ""
} |
q15587 | Job.setPigJob | train | public function setPigJob($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\PigJob::class);
$this->writeOneof(7, $var);
return $this;
} | php | {
"resource": ""
} |
q15588 | Job.setScheduling | train | public function setScheduling($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobScheduling::class);
$this->scheduling = $var;
return $this;
} | php | {
"resource": ""
} |
q15589 | VideoAnnotationResults.setSegmentLabelAnnotations | train | public function setSegmentLabelAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation::class);
$this->segment_label_annotations = $arr;
return $this;
} | php | {
"resource": ""
} |
q15590 | VideoAnnotationResults.setShotLabelAnnotations | train | public function setShotLabelAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation::class);
$this->shot_label_annotations = $arr;
return $this;
} | php | {
"resource": ""
} |
q15591 | ResumableStream.readAll | train | public function readAll()
{
$tries = 0;
$argumentFunction = $this->argumentFunction;
$retryFunction = $this->retryFunction;
do {
$ex = null;
$stream = $this->createExponentialBackoff()->execute($this->apiFunction, $argumentFunction());
try {
foreach ($stream->readAll() as $item) {
yield $item;
}
} catch (\Exception $ex) {
}
$tries++;
} while ((!$this->retryFunction || $retryFunction($ex)) && $tries <= $this->retries);
if ($ex !== null) {
throw $ex;
}
} | php | {
"resource": ""
} |
q15592 | VideoContext.setSegments | train | public function setSegments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class);
$this->segments = $arr;
return $this;
} | php | {
"resource": ""
} |
q15593 | VideoContext.setLabelDetectionConfig | train | public function setLabelDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig::class);
$this->label_detection_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15594 | VideoContext.setFaceDetectionConfig | train | public function setFaceDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig::class);
$this->face_detection_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15595 | Grpc.listDebuggees | train | public function listDebuggees(array $args = [])
{
return $this->send([$this->debuggerClient, 'listDebuggees'], [
$this->pluck('project', $args),
DebuggerClient::getDefaultAgentVersion(),
$args
]);
} | php | {
"resource": ""
} |
q15596 | Grpc.registerDebuggee | train | public function registerDebuggee(array $args = [])
{
return $this->send([$this->controllerClient, 'registerDebuggee'], [
$this->serializer->decodeMessage(
new Debuggee(),
$this->pluck('debuggee', $args)
),
$args
]);
} | php | {
"resource": ""
} |
q15597 | Grpc.listBreakpoints | train | public function listBreakpoints(array $args = [])
{
return $this->send([$this->controllerClient, 'listActiveBreakpoints'], [
$this->pluck('debuggeeId', $args),
$args
]);
} | php | {
"resource": ""
} |
q15598 | Grpc.updateBreakpoint | train | public function updateBreakpoint(array $args)
{
return $this->send([$this->controllerClient, 'updateActiveBreakpoint'], [
$this->pluck('debuggeeId', $args),
$this->serializer->decodeMessage(
new Breakpoint(),
$this->pluck('breakpoint', $args)
),
$args
]);
} | php | {
"resource": ""
} |
q15599 | Grpc.setBreakpoint | train | public function setBreakpoint(array $args)
{
$breakpointArgs = $this->pluckArray([
'action',
'condition',
'expressions',
'logMessageFormat',
'logLevel',
'location'
], $args);
return $this->send([$this->debuggerClient, 'setBreakpoint'], [
$this->pluck('debuggeeId', $args),
$this->serializer->decodeMessage(new Breakpoint(), $breakpointArgs),
DebuggerClient::getDefaultAgentVersion(),
$args
]);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.