repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
googleapis/google-cloud-php
Monitoring/src/V3/ListMetricDescriptorsResponse.php
ListMetricDescriptorsResponse.setMetricDescriptors
public function setMetricDescriptors($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class); $this->metric_descriptors = $arr; return $this; }
php
public function setMetricDescriptors($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class); $this->metric_descriptors = $arr; return $this; }
[ "public", "function", "setMetricDescriptors", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Api", "\\", "MetricDescriptor", "::", "class", ")", ";", "$", "this", "->", "metric_descriptors", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The metric descriptors that are available to the project and that match the value of `filter`, if present. Generated from protobuf field <code>repeated .google.api.MetricDescriptor metric_descriptors = 1;</code> @param \Google\Api\MetricDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "metric", "descriptors", "that", "are", "available", "to", "the", "project", "and", "that", "match", "the", "value", "of", "filter", "if", "present", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListMetricDescriptorsResponse.php#L74-L80
train
googleapis/google-cloud-php
Vision/src/V1/ListProductSetsResponse.php
ListProductSetsResponse.setProductSets
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
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; }
[ "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", ";", "}" ]
List of ProductSets. Generated from protobuf field <code>repeated .google.cloud.vision.v1.ProductSet product_sets = 1;</code> @param \Google\Cloud\Vision\V1\ProductSet[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "List", "of", "ProductSets", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ListProductSetsResponse.php#L68-L74
train
googleapis/google-cloud-php
Scheduler/src/V1beta1/HttpTarget.php
HttpTarget.setHttpMethod
public function setHttpMethod($var) { GPBUtil::checkEnum($var, \Google\Cloud\Scheduler\V1beta1\HttpMethod::class); $this->http_method = $var; return $this; }
php
public function setHttpMethod($var) { GPBUtil::checkEnum($var, \Google\Cloud\Scheduler\V1beta1\HttpMethod::class); $this->http_method = $var; return $this; }
[ "public", "function", "setHttpMethod", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Scheduler", "\\", "V1beta1", "\\", "HttpMethod", "::", "class", ")", ";", "$", "this", "->", "http_method", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Which HTTP method to use for the request. Generated from protobuf field <code>.google.cloud.scheduler.v1beta1.HttpMethod http_method = 2;</code> @param int $var @return $this
[ "Which", "HTTP", "method", "to", "use", "for", "the", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Scheduler/src/V1beta1/HttpTarget.php#L182-L188
train
googleapis/google-cloud-php
Datastore/src/V1/Value.php
Value.setKeyValue
public function setKeyValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Key::class); $this->writeOneof(5, $var); return $this; }
php
public function setKeyValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Key::class); $this->writeOneof(5, $var); return $this; }
[ "public", "function", "setKeyValue", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Datastore", "\\", "V1", "\\", "Key", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "5", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
A key value. Generated from protobuf field <code>.google.datastore.v1.Key key_value = 5;</code> @param \Google\Cloud\Datastore\V1\Key $var @return $this
[ "A", "key", "value", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/Value.php#L239-L245
train
googleapis/google-cloud-php
Monitoring/src/V3/UpdateAlertPolicyRequest.php
UpdateAlertPolicyRequest.setAlertPolicy
public function setAlertPolicy($var) { GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy::class); $this->alert_policy = $var; return $this; }
php
public function setAlertPolicy($var) { GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy::class); $this->alert_policy = $var; return $this; }
[ "public", "function", "setAlertPolicy", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Monitoring", "\\", "V3", "\\", "AlertPolicy", "::", "class", ")", ";", "$", "this", "->", "alert_policy", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Required. The updated alerting policy or the updated values for the fields listed in `update_mask`. If `update_mask` is not empty, any fields in this policy that are not in `update_mask` are ignored. Generated from protobuf field <code>.google.monitoring.v3.AlertPolicy alert_policy = 3;</code> @param \Google\Cloud\Monitoring\V3\AlertPolicy $var @return $this
[ "Required", ".", "The", "updated", "alerting", "policy", "or", "the", "updated", "values", "for", "the", "fields", "listed", "in", "update_mask", ".", "If", "update_mask", "is", "not", "empty", "any", "fields", "in", "this", "policy", "that", "are", "not", "in", "update_mask", "are", "ignored", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/UpdateAlertPolicyRequest.php#L172-L178
train
googleapis/google-cloud-php
Firestore/src/FirestoreClient.php
FirestoreClient.batch
public function batch() { return new WriteBatch( $this->connection, $this->valueMapper, $this->databaseName( $this->projectId, $this->database ) ); }
php
public function batch() { return new WriteBatch( $this->connection, $this->valueMapper, $this->databaseName( $this->projectId, $this->database ) ); }
[ "public", "function", "batch", "(", ")", "{", "return", "new", "WriteBatch", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "this", "->", "databaseName", "(", "$", "this", "->", "projectId", ",", "$", "this", "->", "database", ")", ")", ";", "}" ]
Get a Batch Writer The {@see Google\Cloud\Firestore\WriteBatch} allows more performant multi-document, atomic updates. Example: ``` $batch = $firestore->batch(); ``` @return WriteBatch
[ "Get", "a", "Batch", "Writer" ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/FirestoreClient.php#L171-L181
train
googleapis/google-cloud-php
Firestore/src/FirestoreClient.php
FirestoreClient.collection
public function collection($name) { return $this->getCollectionReference( $this->connection, $this->valueMapper, $this->projectId, $this->database, $name ); }
php
public function collection($name) { return $this->getCollectionReference( $this->connection, $this->valueMapper, $this->projectId, $this->database, $name ); }
[ "public", "function", "collection", "(", "$", "name", ")", "{", "return", "$", "this", "->", "getCollectionReference", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "database", ",", "$", "name", ")", ";", "}" ]
Lazily instantiate a Collection reference. Collections hold Firestore documents. Collections cannot be created or deleted directly - they exist only as implicit namespaces. Once no child documents remain in a collection, it ceases to exist. Example: ``` $collection = $firestore->collection('users'); ``` @param string $name The name of the collection. @return CollectionReference
[ "Lazily", "instantiate", "a", "Collection", "reference", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/FirestoreClient.php#L198-L207
train
googleapis/google-cloud-php
Firestore/src/FirestoreClient.php
FirestoreClient.collections
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
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 ] ) ); }
[ "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", "]", ")", ")", ";", "}" ]
List root-level collections in the database. Example: ``` $collections = $firestore->collections(); ``` @codingStandardsIgnoreStart @see https://firebase.google.com/docs/firestore/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.ListCollectionIds ListCollectionIds @codingStandardsIgnoreEnd @param array $options [optional] { Configuration options @type int $pageSize Maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<CollectionReference>
[ "List", "root", "-", "level", "collections", "in", "the", "database", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/FirestoreClient.php#L233-L251
train
googleapis/google-cloud-php
Firestore/src/FirestoreClient.php
FirestoreClient.document
public function document($name) { return $this->getDocumentReference( $this->connection, $this->valueMapper, $this->projectId, $this->database, $name ); }
php
public function document($name) { return $this->getDocumentReference( $this->connection, $this->valueMapper, $this->projectId, $this->database, $name ); }
[ "public", "function", "document", "(", "$", "name", ")", "{", "return", "$", "this", "->", "getDocumentReference", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "database", ",", "$", "name", ")", ";", "}" ]
Get a reference to a Firestore document. Example: ``` $document = $firestore->document('users/john'); ``` @param string $name The document name or a path, relative to the database. @return DocumentReference @throws \InvalidArgumentException If the given path is not a valid document path.
[ "Get", "a", "reference", "to", "a", "Firestore", "document", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/FirestoreClient.php#L265-L274
train
googleapis/google-cloud-php
Firestore/src/FirestoreClient.php
FirestoreClient.runTransaction
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
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 ]); }
[ "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", "]", ")", ";", "}" ]
Executes a function in a Firestore transaction. Transactions offer atomic operations, guaranteeing that either all writes will be applied, or none will be applied. The Google Cloud PHP Firestore client also handles automatic retry in cases where transactions fail due to a retryable error. Transactions will be committed once the provided callable has finished execution. Thrown exceptions will prevent commit and trigger a rollback, and will bubble up to your level to be handled in whatever fashion is appropriate. This method returns the return value of the given transaction callable. Example: ``` use Google\Cloud\Firestore\Transaction; $transferAmount = 500.00; $from = $firestore->document('users/john'); $to = $firestore->document('users/dave'); $toNewBalance = $firestore->runTransaction(function (Transaction $t) use ($from, $to, $transferAmount) { $fromSnapshot = $t->snapshot($from); $toSnapshot = $t->snapshot($to); $fromNewBalance = $fromSnapshot['balance'] - $transferAmount; $toNewBalance = $toSnapshot['balance'] + $transferAmount; // If the transaction cannot be completed, throwing any exception // will trigger a rollback operation. if ($fromNewBalance < 0) { throw new \Exception('User 1 has insufficient funds!'); } $t->update($from, [ ['path' => 'balance', 'value' => $fromNewBalance] ])->update($to, [ ['path' => 'balance', 'value' => $toNewBalance] ]); return $toNewBalance; }); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.BeginTransaction BeginTransaction @see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Commit Commit @see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Rollback Rollback @codingStandardsIgnoreEnd @param callable $callable A callable function, allowing atomic operations against the Firestore API. Function signature should be of form: `function (Transaction $t)`. @param array $options { Configuration Options. @type array $begin Configuration options for BeginTransaction. @type array $commit Configuration options for Commit. @type array $rollback Configuration options for rollback. @type int $maxRetries The maximum number of times to retry failures. **Defaults to** `5`. } @return mixed
[ "Executes", "a", "function", "in", "a", "Firestore", "transaction", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/FirestoreClient.php#L394-L469
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/UpdateFieldRequest.php
UpdateFieldRequest.setField
public function setField($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Field::class); $this->field = $var; return $this; }
php
public function setField($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Field::class); $this->field = $var; return $this; }
[ "public", "function", "setField", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "Admin", "\\", "V1", "\\", "Field", "::", "class", ")", ";", "$", "this", "->", "field", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The field to be updated. Generated from protobuf field <code>.google.firestore.admin.v1.Field field = 1;</code> @param \Google\Cloud\Firestore\Admin\V1\Field $var @return $this
[ "The", "field", "to", "be", "updated", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/UpdateFieldRequest.php#L68-L74
train
googleapis/google-cloud-php
Spanner/src/V1/Mutation.php
Mutation.setDelete
public function setDelete($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation_Delete::class); $this->writeOneof(5, $var); return $this; }
php
public function setDelete($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation_Delete::class); $this->writeOneof(5, $var); return $this; }
[ "public", "function", "setDelete", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Spanner", "\\", "V1", "\\", "Mutation_Delete", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "5", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Delete rows from a table. Succeeds whether or not the named rows were present. Generated from protobuf field <code>.google.spanner.v1.Mutation.Delete delete = 5;</code> @param \Google\Cloud\Spanner\V1\Mutation\Delete $var @return $this
[ "Delete", "rows", "from", "a", "table", ".", "Succeeds", "whether", "or", "not", "the", "named", "rows", "were", "present", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/Mutation.php#L194-L200
train
googleapis/google-cloud-php
WebRisk/src/V1beta1/SearchUrisResponse.php
SearchUrisResponse.setThreat
public function setThreat($var) { GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse_ThreatUri::class); $this->threat = $var; return $this; }
php
public function setThreat($var) { GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse_ThreatUri::class); $this->threat = $var; return $this; }
[ "public", "function", "setThreat", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "WebRisk", "\\", "V1beta1", "\\", "SearchUrisResponse_ThreatUri", "::", "class", ")", ";", "$", "this", "->", "threat", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The threat list matches. This may be empty if the URI is on no list. Generated from protobuf field <code>.google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri threat = 1;</code> @param \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse\ThreatUri $var @return $this
[ "The", "threat", "list", "matches", ".", "This", "may", "be", "empty", "if", "the", "URI", "is", "on", "no", "list", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/WebRisk/src/V1beta1/SearchUrisResponse.php#L56-L62
train
googleapis/google-cloud-php
BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php
ListTransferConfigsRequest.setDataSourceIds
public function setDataSourceIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->data_source_ids = $arr; return $this; }
php
public function setDataSourceIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->data_source_ids = $arr; return $this; }
[ "public", "function", "setDataSourceIds", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "data_source_ids", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
When specified, only configurations of requested data sources are returned. Generated from protobuf field <code>repeated string data_source_ids = 2;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "When", "specified", "only", "configurations", "of", "requested", "data", "sources", "are", "returned", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php#L120-L126
train
googleapis/google-cloud-php
Core/src/ClientTrait.php
ClientTrait.getConnectionType
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
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; }
[ "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", ";", "}" ]
Get either a gRPC or REST connection based on the provided config and the system dependencies available. @param array $config @return string @throws GoogleException
[ "Get", "either", "a", "gRPC", "or", "REST", "connection", "based", "on", "the", "provided", "config", "and", "the", "system", "dependencies", "available", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ClientTrait.php#L47-L65
train
googleapis/google-cloud-php
Core/src/ClientTrait.php
ClientTrait.configureAuthentication
private function configureAuthentication(array $config) { $config['keyFile'] = $this->getKeyFile($config); $this->projectId = $this->detectProjectId($config); return $config; }
php
private function configureAuthentication(array $config) { $config['keyFile'] = $this->getKeyFile($config); $this->projectId = $this->detectProjectId($config); return $config; }
[ "private", "function", "configureAuthentication", "(", "array", "$", "config", ")", "{", "$", "config", "[", "'keyFile'", "]", "=", "$", "this", "->", "getKeyFile", "(", "$", "config", ")", ";", "$", "this", "->", "projectId", "=", "$", "this", "->", "detectProjectId", "(", "$", "config", ")", ";", "return", "$", "config", ";", "}" ]
Fetch and validate the keyfile and set the project ID. @param array $config @return array
[ "Fetch", "and", "validate", "the", "keyfile", "and", "set", "the", "project", "ID", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ClientTrait.php#L97-L103
train
googleapis/google-cloud-php
Core/src/ClientTrait.php
ClientTrait.getKeyFile
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
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(); }
[ "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", "(", ")", ";", "}" ]
Get a keyfile if it exists. Process: 1. If $config['keyFile'] is set, use that. 2. If $config['keyFilePath'] is set, load the file and use that. 3. If GOOGLE_APPLICATION_CREDENTIALS environment variable is set, load from that location and use that. 4. If OS-specific well-known-file is set, load from that location and use that. @param array $config @return array|null Key data @throws GoogleException
[ "Get", "a", "keyfile", "if", "it", "exists", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ClientTrait.php#L120-L153
train
googleapis/google-cloud-php
Core/src/ClientTrait.php
ClientTrait.detectProjectId
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
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.' ); } }
[ "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.'", ")", ";", "}", "}" ]
Detect and return a project ID. Process: 1. If $config['projectId'] is set, use that. 2. If an emulator is enabled, return a dummy value. 3. If $config['keyFile'] is set, attempt to retrieve a project ID from that. 4. Check `GOOGLE_CLOUD_PROJECT` environment variable. 5. Check `GCLOUD_PROJECT` environment variable. 6. If code is running on compute engine, try to get the project ID from the metadata store. 7. Throw exception. @param array $config @return string @throws GoogleException
[ "Detect", "and", "return", "a", "project", "ID", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ClientTrait.php#L173-L239
train
googleapis/google-cloud-php
Container/src/V1/AddonsConfig.php
AddonsConfig.setHorizontalPodAutoscaling
public function setHorizontalPodAutoscaling($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\HorizontalPodAutoscaling::class); $this->horizontal_pod_autoscaling = $var; return $this; }
php
public function setHorizontalPodAutoscaling($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\HorizontalPodAutoscaling::class); $this->horizontal_pod_autoscaling = $var; return $this; }
[ "public", "function", "setHorizontalPodAutoscaling", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Container", "\\", "V1", "\\", "HorizontalPodAutoscaling", "::", "class", ")", ";", "$", "this", "->", "horizontal_pod_autoscaling", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods. Generated from protobuf field <code>.google.container.v1.HorizontalPodAutoscaling horizontal_pod_autoscaling = 2;</code> @param \Google\Cloud\Container\V1\HorizontalPodAutoscaling $var @return $this
[ "Configuration", "for", "the", "horizontal", "pod", "autoscaling", "feature", "which", "increases", "or", "decreases", "the", "number", "of", "replica", "pods", "a", "replication", "controller", "has", "based", "on", "the", "resource", "usage", "of", "the", "existing", "pods", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/AddonsConfig.php#L125-L131
train
googleapis/google-cloud-php
Container/src/V1/AddonsConfig.php
AddonsConfig.setKubernetesDashboard
public function setKubernetesDashboard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\KubernetesDashboard::class); $this->kubernetes_dashboard = $var; return $this; }
php
public function setKubernetesDashboard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\KubernetesDashboard::class); $this->kubernetes_dashboard = $var; return $this; }
[ "public", "function", "setKubernetesDashboard", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Container", "\\", "V1", "\\", "KubernetesDashboard", "::", "class", ")", ";", "$", "this", "->", "kubernetes_dashboard", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Configuration for the Kubernetes Dashboard. Generated from protobuf field <code>.google.container.v1.KubernetesDashboard kubernetes_dashboard = 3;</code> @param \Google\Cloud\Container\V1\KubernetesDashboard $var @return $this
[ "Configuration", "for", "the", "Kubernetes", "Dashboard", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/AddonsConfig.php#L151-L157
train
googleapis/google-cloud-php
Container/src/V1/AddonsConfig.php
AddonsConfig.setNetworkPolicyConfig
public function setNetworkPolicyConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\NetworkPolicyConfig::class); $this->network_policy_config = $var; return $this; }
php
public function setNetworkPolicyConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\NetworkPolicyConfig::class); $this->network_policy_config = $var; return $this; }
[ "public", "function", "setNetworkPolicyConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Container", "\\", "V1", "\\", "NetworkPolicyConfig", "::", "class", ")", ";", "$", "this", "->", "network_policy_config", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Configuration for NetworkPolicy. This only tracks whether the addon is enabled or not on the Master, it does not track whether network policy is enabled for the nodes. Generated from protobuf field <code>.google.container.v1.NetworkPolicyConfig network_policy_config = 4;</code> @param \Google\Cloud\Container\V1\NetworkPolicyConfig $var @return $this
[ "Configuration", "for", "NetworkPolicy", ".", "This", "only", "tracks", "whether", "the", "addon", "is", "enabled", "or", "not", "on", "the", "Master", "it", "does", "not", "track", "whether", "network", "policy", "is", "enabled", "for", "the", "nodes", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/AddonsConfig.php#L181-L187
train
googleapis/google-cloud-php
Talent/src/V4beta1/ListTenantsResponse.php
ListTenantsResponse.setTenants
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
public function setTenants($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Tenant::class); $this->tenants = $arr; return $this; }
[ "public", "function", "setTenants", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Tenant", "::", "class", ")", ";", "$", "this", "->", "tenants", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Tenants for the current client. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Tenant tenants = 1;</code> @param \Google\Cloud\Talent\V4beta1\Tenant[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Tenants", "for", "the", "current", "client", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ListTenantsResponse.php#L77-L83
train
googleapis/google-cloud-php
Firestore/src/V1/Target.php
Target.setQuery
public function setQuery($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_QueryTarget::class); $this->writeOneof(2, $var); return $this; }
php
public function setQuery($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_QueryTarget::class); $this->writeOneof(2, $var); return $this; }
[ "public", "function", "setQuery", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "V1", "\\", "Target_QueryTarget", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "2", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
A target specified by a query. Generated from protobuf field <code>.google.firestore.v1.Target.QueryTarget query = 2;</code> @param \Google\Cloud\Firestore\V1\Target\QueryTarget $var @return $this
[ "A", "target", "specified", "by", "a", "query", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1/Target.php#L88-L94
train
googleapis/google-cloud-php
Firestore/src/V1/Target.php
Target.setDocuments
public function setDocuments($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_DocumentsTarget::class); $this->writeOneof(3, $var); return $this; }
php
public function setDocuments($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_DocumentsTarget::class); $this->writeOneof(3, $var); return $this; }
[ "public", "function", "setDocuments", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "V1", "\\", "Target_DocumentsTarget", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "3", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
A target specified by a set of document names. Generated from protobuf field <code>.google.firestore.v1.Target.DocumentsTarget documents = 3;</code> @param \Google\Cloud\Firestore\V1\Target\DocumentsTarget $var @return $this
[ "A", "target", "specified", "by", "a", "set", "of", "document", "names", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1/Target.php#L114-L120
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.createSnapshot
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
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); }
[ "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", ")", ";", "}" ]
Execute a service request to retrieve a document snapshot. @param ConnectionInterface $connection A Connection to Cloud Firestore. @param ValueMapper $valueMapper A Firestore Value Mapper. @param DocumentReference $reference The parent document. @param array $options { Configuration Options @type string $transaction The transaction ID to fetch the snapshot. } @return DocumentSnapshot
[ "Execute", "a", "service", "request", "to", "retrieve", "a", "document", "snapshot", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L50-L67
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.createSnapshotWithData
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
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); }
[ "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", ")", ";", "}" ]
Create a document snapshot by providing a dataset. This method will not perform a service request. @codingStandardsIgnoreStart @param ValueMapper $valueMapper A Firestore Value Mapper. @param DocumentReference $reference The parent document. @param array $document [Document](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Document) @param bool $exists Whether the document exists. **Defaults to** `true`. @codingStandardsIgnoreEnd
[ "Create", "a", "document", "snapshot", "by", "providing", "a", "dataset", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L81-L94
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.getSnapshot
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
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']; }
[ "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'", "]", ";", "}" ]
Send a service request for a snapshot, and return the raw data @param ConnectionInterface $connection A Connection to Cloud Firestore @param string $name The document name. @param array $options Configuration options. @return array @throws \InvalidArgumentException if an invalid `$options.readTime` is specified. @throws NotFoundException If the document does not exist.
[ "Send", "a", "service", "request", "for", "a", "snapshot", "and", "return", "the", "raw", "data" ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L106-L132
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.getDocumentReference
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
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 ); }
[ "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", ")", ";", "}" ]
Creates a DocumentReference object. @param ConnectionInterface $connection A connection to Cloud Firestore. @param ValueMapper $mapper A Firestore value mapper. @param string $projectId The current project id. @param string $database The database id. @param string $name The document name, in absolute form, or relative to the database. @return DocumentReference @throws InvalidArgumentException if an invalid path is provided.
[ "Creates", "a", "DocumentReference", "object", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L225-L269
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.getCollectionReference
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
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); }
[ "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", ")", ";", "}" ]
Creates a CollectionReference object. @param ConnectionInterface $connection A connection to Cloud Firestore. @param ValueMapper $mapper A Firestore value mapper. @param string $projectId The current project id. @param string $database The database id. @param string $name The collection name, in absolute form, or relative to the database. @return CollectionReference @throws InvalidArgumentException if an invalid path is provided.
[ "Creates", "a", "CollectionReference", "object", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L282-L301
train
googleapis/google-cloud-php
Firestore/src/SnapshotTrait.php
SnapshotTrait.transformSnapshotTimestamps
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
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; }
[ "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", ";", "}" ]
Convert snapshot timestamps to Google Cloud PHP types. @param array $data The snapshot data. @return array
[ "Convert", "snapshot", "timestamps", "to", "Google", "Cloud", "PHP", "types", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/SnapshotTrait.php#L309-L322
train
googleapis/google-cloud-php
Spanner/src/V1/ResultSet.php
ResultSet.setMetadata
public function setMetadata($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); $this->metadata = $var; return $this; }
php
public function setMetadata($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); $this->metadata = $var; return $this; }
[ "public", "function", "setMetadata", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Spanner", "\\", "V1", "\\", "ResultSetMetadata", "::", "class", ")", ";", "$", "this", "->", "metadata", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Metadata about the result set, such as row type information. Generated from protobuf field <code>.google.spanner.v1.ResultSetMetadata metadata = 1;</code> @param \Google\Cloud\Spanner\V1\ResultSetMetadata $var @return $this
[ "Metadata", "about", "the", "result", "set", "such", "as", "row", "type", "information", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/ResultSet.php#L99-L105
train
googleapis/google-cloud-php
Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php
UpdateInstanceMetadata.setInstance
public function setInstance($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); $this->instance = $var; return $this; }
php
public function setInstance($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); $this->instance = $var; return $this; }
[ "public", "function", "setInstance", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Spanner", "\\", "Admin", "\\", "Instance", "\\", "V1", "\\", "Instance", "::", "class", ")", ";", "$", "this", "->", "instance", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The desired end state of the update. Generated from protobuf field <code>.google.spanner.admin.instance.v1.Instance instance = 1;</code> @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var @return $this
[ "The", "desired", "end", "state", "of", "the", "update", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php#L91-L97
train
googleapis/google-cloud-php
Logging/src/V2/UpdateLogMetricRequest.php
UpdateLogMetricRequest.setMetric
public function setMetric($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogMetric::class); $this->metric = $var; return $this; }
php
public function setMetric($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogMetric::class); $this->metric = $var; return $this; }
[ "public", "function", "setMetric", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "V2", "\\", "LogMetric", "::", "class", ")", ";", "$", "this", "->", "metric", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The updated metric. Generated from protobuf field <code>.google.logging.v2.LogMetric metric = 2;</code> @param \Google\Cloud\Logging\V2\LogMetric $var @return $this
[ "The", "updated", "metric", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/UpdateLogMetricRequest.php#L108-L114
train
googleapis/google-cloud-php
Talent/src/V4beta1/ListApplicationsResponse.php
ListApplicationsResponse.setApplications
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
public function setApplications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Application::class); $this->applications = $arr; return $this; }
[ "public", "function", "setApplications", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Application", "::", "class", ")", ";", "$", "this", "->", "applications", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Applications for the current client. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Application applications = 1;</code> @param \Google\Cloud\Talent\V4beta1\Application[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Applications", "for", "the", "current", "client", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ListApplicationsResponse.php#L77-L83
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setQuickReplies
public function setQuickReplies($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_QuickReplies::class); $this->writeOneof(3, $var); return $this; }
php
public function setQuickReplies($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_QuickReplies::class); $this->writeOneof(3, $var); return $this; }
[ "public", "function", "setQuickReplies", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_QuickReplies", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "3", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The quick replies response. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.QuickReplies quick_replies = 3;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\QuickReplies $var @return $this
[ "The", "quick", "replies", "response", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L135-L141
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setCard
public function setCard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Card::class); $this->writeOneof(4, $var); return $this; }
php
public function setCard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Card::class); $this->writeOneof(4, $var); return $this; }
[ "public", "function", "setCard", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_Card", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "4", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The card response. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.Card card = 4;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\Card $var @return $this
[ "The", "card", "response", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L161-L167
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setSimpleResponses
public function setSimpleResponses($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_SimpleResponses::class); $this->writeOneof(7, $var); return $this; }
php
public function setSimpleResponses($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_SimpleResponses::class); $this->writeOneof(7, $var); return $this; }
[ "public", "function", "setSimpleResponses", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_SimpleResponses", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "7", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The voice and text-only responses for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses simple_responses = 7;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\SimpleResponses $var @return $this
[ "The", "voice", "and", "text", "-", "only", "responses", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L217-L223
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setBasicCard
public function setBasicCard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_BasicCard::class); $this->writeOneof(8, $var); return $this; }
php
public function setBasicCard($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_BasicCard::class); $this->writeOneof(8, $var); return $this; }
[ "public", "function", "setBasicCard", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_BasicCard", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "8", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The basic card response for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.BasicCard basic_card = 8;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\BasicCard $var @return $this
[ "The", "basic", "card", "response", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L243-L249
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setSuggestions
public function setSuggestions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Suggestions::class); $this->writeOneof(9, $var); return $this; }
php
public function setSuggestions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Suggestions::class); $this->writeOneof(9, $var); return $this; }
[ "public", "function", "setSuggestions", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_Suggestions", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "9", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The suggestion chips for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.Suggestions suggestions = 9;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\Suggestions $var @return $this
[ "The", "suggestion", "chips", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L269-L275
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setLinkOutSuggestion
public function setLinkOutSuggestion($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_LinkOutSuggestion::class); $this->writeOneof(10, $var); return $this; }
php
public function setLinkOutSuggestion($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_LinkOutSuggestion::class); $this->writeOneof(10, $var); return $this; }
[ "public", "function", "setLinkOutSuggestion", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_LinkOutSuggestion", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "10", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The link out suggestion chip for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion link_out_suggestion = 10;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\LinkOutSuggestion $var @return $this
[ "The", "link", "out", "suggestion", "chip", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L295-L301
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setListSelect
public function setListSelect($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_ListSelect::class); $this->writeOneof(11, $var); return $this; }
php
public function setListSelect($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_ListSelect::class); $this->writeOneof(11, $var); return $this; }
[ "public", "function", "setListSelect", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_ListSelect", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "11", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The list card response for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.ListSelect list_select = 11;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\ListSelect $var @return $this
[ "The", "list", "card", "response", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L321-L327
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setCarouselSelect
public function setCarouselSelect($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_CarouselSelect::class); $this->writeOneof(12, $var); return $this; }
php
public function setCarouselSelect($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_CarouselSelect::class); $this->writeOneof(12, $var); return $this; }
[ "public", "function", "setCarouselSelect", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_CarouselSelect", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "12", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
The carousel card response for Actions on Google. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect carousel_select = 12;</code> @param \Google\Cloud\Dialogflow\V2\Intent\Message\CarouselSelect $var @return $this
[ "The", "carousel", "card", "response", "for", "Actions", "on", "Google", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L347-L353
train
googleapis/google-cloud-php
Dialogflow/src/V2/Intent/Message.php
Message.setPlatform
public function setPlatform($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Platform::class); $this->platform = $var; return $this; }
php
public function setPlatform($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Platform::class); $this->platform = $var; return $this; }
[ "public", "function", "setPlatform", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Intent_Message_Platform", "::", "class", ")", ";", "$", "this", "->", "platform", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. The platform that this message is intended for. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.Platform platform = 6;</code> @param int $var @return $this
[ "Optional", ".", "The", "platform", "that", "this", "message", "is", "intended", "for", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message.php#L373-L379
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/ExportDocumentsMetadata.php
ExportDocumentsMetadata.setOperationState
public function setOperationState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Firestore\Admin\V1\OperationState::class); $this->operation_state = $var; return $this; }
php
public function setOperationState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Firestore\Admin\V1\OperationState::class); $this->operation_state = $var; return $this; }
[ "public", "function", "setOperationState", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "Admin", "\\", "V1", "\\", "OperationState", "::", "class", ")", ";", "$", "this", "->", "operation_state", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The state of the export operation. Generated from protobuf field <code>.google.firestore.admin.v1.OperationState operation_state = 3;</code> @param int $var @return $this
[ "The", "state", "of", "the", "export", "operation", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/ExportDocumentsMetadata.php#L163-L169
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/ExportDocumentsMetadata.php
ExportDocumentsMetadata.setProgressDocuments
public function setProgressDocuments($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class); $this->progress_documents = $var; return $this; }
php
public function setProgressDocuments($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class); $this->progress_documents = $var; return $this; }
[ "public", "function", "setProgressDocuments", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "Admin", "\\", "V1", "\\", "Progress", "::", "class", ")", ";", "$", "this", "->", "progress_documents", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The progress, in documents, of this operation. Generated from protobuf field <code>.google.firestore.admin.v1.Progress progress_documents = 4;</code> @param \Google\Cloud\Firestore\Admin\V1\Progress $var @return $this
[ "The", "progress", "in", "documents", "of", "this", "operation", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/ExportDocumentsMetadata.php#L189-L195
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/ExportDocumentsMetadata.php
ExportDocumentsMetadata.setProgressBytes
public function setProgressBytes($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class); $this->progress_bytes = $var; return $this; }
php
public function setProgressBytes($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Progress::class); $this->progress_bytes = $var; return $this; }
[ "public", "function", "setProgressBytes", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "Admin", "\\", "V1", "\\", "Progress", "::", "class", ")", ";", "$", "this", "->", "progress_bytes", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The progress, in bytes, of this operation. Generated from protobuf field <code>.google.firestore.admin.v1.Progress progress_bytes = 5;</code> @param \Google\Cloud\Firestore\Admin\V1\Progress $var @return $this
[ "The", "progress", "in", "bytes", "of", "this", "operation", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/ExportDocumentsMetadata.php#L215-L221
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/ExportDocumentsMetadata.php
ExportDocumentsMetadata.setCollectionIds
public function setCollectionIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->collection_ids = $arr; return $this; }
php
public function setCollectionIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->collection_ids = $arr; return $this; }
[ "public", "function", "setCollectionIds", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "collection_ids", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Which collection ids are being exported. Generated from protobuf field <code>repeated string collection_ids = 6;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Which", "collection", "ids", "are", "being", "exported", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/ExportDocumentsMetadata.php#L241-L247
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.reload
public function reload(array $options = []) { return $this->info = $this->connection->getDatabase([ 'name' => $this->name ] + $options); }
php
public function reload(array $options = []) { return $this->info = $this->connection->getDatabase([ 'name' => $this->name ] + $options); }
[ "public", "function", "reload", "(", "array", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "info", "=", "$", "this", "->", "connection", "->", "getDatabase", "(", "[", "'name'", "=>", "$", "this", "->", "name", "]", "+", "$", "options", ")", ";", "}" ]
Reload the database info from the Cloud Spanner API. Example: ``` $info = $database->reload(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.Database Database @codingStandardsIgnoreEnd @param array $options [optional] Configuration options. @return array
[ "Reload", "the", "database", "info", "from", "the", "Cloud", "Spanner", "API", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L252-L257
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.create
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
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); }
[ "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", ")", ";", "}" ]
Create a new Cloud Spanner database. Example: ``` $operation = $database->create(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#createdatabaserequest CreateDatabaseRequest @codingStandardsIgnoreEnd @param array $options [optional] { Configuration Options @type string[] $statements Additional DDL statements. } @return LongRunningOperation<Database>
[ "Create", "a", "new", "Cloud", "Spanner", "database", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L306-L322
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.updateDdlBatch
public function updateDdlBatch(array $statements, array $options = []) { $operation = $this->connection->updateDatabaseDdl($options + [ 'name' => $this->name, 'statements' => $statements, ]); return $this->resumeOperation($operation['name'], $operation); }
php
public function updateDdlBatch(array $statements, array $options = []) { $operation = $this->connection->updateDatabaseDdl($options + [ 'name' => $this->name, 'statements' => $statements, ]); return $this->resumeOperation($operation['name'], $operation); }
[ "public", "function", "updateDdlBatch", "(", "array", "$", "statements", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "operation", "=", "$", "this", "->", "connection", "->", "updateDatabaseDdl", "(", "$", "options", "+", "[", "'name'", "=>", "$", "this", "->", "name", ",", "'statements'", "=>", "$", "statements", ",", "]", ")", ";", "return", "$", "this", "->", "resumeOperation", "(", "$", "operation", "[", "'name'", "]", ",", "$", "operation", ")", ";", "}" ]
Update the Database schema by running a set of SQL statements. **NOTE**: Requires `https://www.googleapis.com/auth/spanner.admin` scope. Example: ``` $database->updateDdlBatch([ 'CREATE TABLE Users ( id INT64 NOT NULL, name STRING(100) NOT NULL, password STRING(100) NOT NULL ) PRIMARY KEY (id)', 'CREATE TABLE Posts ( id INT64 NOT NULL, title STRING(100) NOT NULL, content STRING(MAX) NOT NULL ) PRIMARY KEY(id)' ]); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/docs/data-definition-language Data Definition Language @see https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.UpdateDatabaseDdlRequest UpdateDDLRequest @codingStandardsIgnoreEnd @param string[] $statements A list of DDL statements to run against a database. @param array $options [optional] Configuration options. @return LongRunningOperation
[ "Update", "the", "Database", "schema", "by", "running", "a", "set", "of", "SQL", "statements", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L384-L392
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.drop
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
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; } }
[ "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", ";", "}", "}" ]
Drop the database. Please note that after a database is dropped, all sessions attached to it will be invalid and unusable. Calls to this method will clear any session pool attached to this database class instance and delete any sessions attached to the database class instance. **NOTE**: Requires `https://www.googleapis.com/auth/spanner.admin` scope. Example: ``` $database->drop(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DropDatabaseRequest DropDatabaseRequest @codingStandardsIgnoreEnd @param array $options [optional] Configuration options. @return void
[ "Drop", "the", "database", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L416-L430
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.ddl
public function ddl(array $options = []) { $ddl = $this->connection->getDatabaseDDL($options + [ 'name' => $this->name ]); if (isset($ddl['statements'])) { return $ddl['statements']; } return []; }
php
public function ddl(array $options = []) { $ddl = $this->connection->getDatabaseDDL($options + [ 'name' => $this->name ]); if (isset($ddl['statements'])) { return $ddl['statements']; } return []; }
[ "public", "function", "ddl", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "ddl", "=", "$", "this", "->", "connection", "->", "getDatabaseDDL", "(", "$", "options", "+", "[", "'name'", "=>", "$", "this", "->", "name", "]", ")", ";", "if", "(", "isset", "(", "$", "ddl", "[", "'statements'", "]", ")", ")", "{", "return", "$", "ddl", "[", "'statements'", "]", ";", "}", "return", "[", "]", ";", "}" ]
Get a list of all database DDL statements. **NOTE**: Requires `https://www.googleapis.com/auth/spanner.admin` scope. Example: ``` $statements = $database->ddl(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#getdatabaseddlrequest GetDatabaseDdlRequest @codingStandardsIgnoreEnd @param array $options [optional] Configuration options. @return array
[ "Get", "a", "list", "of", "all", "database", "DDL", "statements", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L449-L460
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.iam
public function iam() { if (!$this->iam) { $this->iam = new Iam( new IamDatabase($this->connection), $this->name ); } return $this->iam; }
php
public function iam() { if (!$this->iam) { $this->iam = new Iam( new IamDatabase($this->connection), $this->name ); } return $this->iam; }
[ "public", "function", "iam", "(", ")", "{", "if", "(", "!", "$", "this", "->", "iam", ")", "{", "$", "this", "->", "iam", "=", "new", "Iam", "(", "new", "IamDatabase", "(", "$", "this", "->", "connection", ")", ",", "$", "this", "->", "name", ")", ";", "}", "return", "$", "this", "->", "iam", ";", "}" ]
Manage the database IAM policy Example: ``` $iam = $database->iam(); ``` @return Iam
[ "Manage", "the", "database", "IAM", "policy" ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L472-L482
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.snapshot
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
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(); } }
[ "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", "(", ")", ";", "}", "}" ]
Create a snapshot to read from a database at a point in time. If no configuration options are provided, transaction will be opened with strong consistency. Snapshots are executed behind the scenes using a Read-Only Transaction. Example: ``` $snapshot = $database->snapshot(); ``` ``` // Take a shapshot with a returned timestamp. $snapshot = $database->snapshot([ 'returnReadTimestamp' => true ]); $timestamp = $snapshot->readTimestamp(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.BeginTransactionRequest BeginTransactionRequest @see https://cloud.google.com/spanner/docs/transactions Transactions @param array $options [optional] { Configuration Options See [ReadOnly](https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.TransactionOptions.ReadOnly) for detailed description of available options. Please note that only one of `$strong`, `$readTimestamp` or `$exactStaleness` may be set in a request. @type bool $returnReadTimestamp If true, the Cloud Spanner-selected read timestamp is included in the Transaction message that describes the transaction. @type bool $strong Read at a timestamp where all previously committed transactions are visible. @type Timestamp $readTimestamp Executes all reads at the given timestamp. @type Duration $exactStaleness Represents a number of seconds. Executes all reads at a timestamp that is $exactStaleness old. @type Timestamp $minReadTimestamp Executes all reads at a timestamp >= min_read_timestamp. Only available when `$options.singleUse` is true. @type Duration $maxStaleness Read data at a timestamp >= NOW - max_staleness seconds. Guarantees that all writes that have committed more than the specified number of seconds ago are visible. Only available when `$options.singleUse` is true. @type bool $singleUse If true, a Transaction ID will not be allocated up front. Instead, the transaction will be considered "single-use", and may be used for only a single operation. **Defaults to** `false`. @type array $sessionOptions Session configuration and request options. Session labels may be applied using the `labels` key. } @return Snapshot @throws \BadMethodCallException If attempting to call this method within an existing transaction. @codingStandardsIgnoreEnd
[ "Create", "a", "snapshot", "to", "read", "from", "a", "database", "at", "a", "point", "in", "time", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L547-L569
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.insertBatch
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
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); }
[ "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", ")", ";", "}" ]
Insert multiple rows. Mutations are committed in a single-use transaction. Since this method does not feature replay protection, it may attempt to apply mutations more than once; if the mutations are not idempotent, this may lead to a failure being reported when the mutation was previously applied. Example: ``` $database->insertBatch('Posts', [ [ 'ID' => 1337, 'postTitle' => 'Hello World!', 'postContent' => 'Welcome to our site.' ], [ 'ID' => 1338, 'postTitle' => 'Our History', 'postContent' => 'Lots of people ask about where we got started.' ] ]); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.CommitRequest CommitRequest @codingStandardsIgnoreEnd @param string $table The table to mutate. @param array $dataSet The row data to insert. @param array $options [optional] Configuration options. @return Timestamp The commit Timestamp.
[ "Insert", "multiple", "rows", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L850-L858
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.updateBatch
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
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); }
[ "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", ")", ";", "}" ]
Update multiple rows. Only data which you wish to update need be included. The list of columns must contain enough columns to allow Cloud Spanner to derive values for all primary key columns in the row(s) to be modified. Mutations are committed in a single-use transaction. Example: ``` $database->updateBatch('Posts', [ [ 'ID' => 1337, 'postContent' => 'Thanks for visiting our site!' ], [ 'ID' => 1338, 'postContent' => 'A little bit about us!' ] ]); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.CommitRequest CommitRequest @codingStandardsIgnoreEnd @param string $table The table to mutate. @param array $dataSet The row data to update. @param array $options [optional] Configuration options. @return Timestamp The commit Timestamp.
[ "Update", "multiple", "rows", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L922-L930
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.insertOrUpdateBatch
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
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); }
[ "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", ")", ";", "}" ]
Insert or update multiple rows. If a row already exists (determined by comparing the Primary Key to existing table data), the row will be updated. If not, it will be created. Mutations are committed in a single-use transaction. Example: ``` $database->insertOrUpdateBatch('Posts', [ [ 'ID' => 1337, 'postTitle' => 'Hello World!', 'postContent' => 'Thanks for visiting our site!' ], [ 'ID' => 1338, 'postTitle' => 'Our History', 'postContent' => 'A little bit about us!' ] ]); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.CommitRequest CommitRequest @codingStandardsIgnoreEnd @param string $table The table to mutate. @param array $dataSet The row data to insert or update. @param array $options [optional] Configuration options. @return Timestamp The commit Timestamp.
[ "Insert", "or", "update", "multiple", "rows", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L997-L1005
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.replaceBatch
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
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); }
[ "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", ")", ";", "}" ]
Replace multiple rows. Provide data for the entire row. Cloud Spanner will attempt to find a record matching the Primary Key, and will replace the entire row. If a matching row is not found, it will be inserted. Mutations are committed in a single-use transaction. Example: ``` $database->replaceBatch('Posts', [ [ 'ID' => 1337, 'postTitle' => 'Hello World!', 'postContent' => 'Thanks for visiting our site!' ], [ 'ID' => 1338, 'postTitle' => 'Our History', 'postContent' => 'A little bit about us!' ] ]); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.CommitRequest CommitRequest @codingStandardsIgnoreEnd @param string $table The table to mutate. @param array $dataSet The row data to replace. @param array $options [optional] Configuration options. @return Timestamp The commit Timestamp.
[ "Replace", "multiple", "rows", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1072-L1080
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.delete
public function delete($table, KeySet $keySet, array $options = []) { $mutations = [$this->operation->deleteMutation($table, $keySet)]; return $this->commitInSingleUseTransaction($mutations, $options); }
php
public function delete($table, KeySet $keySet, array $options = []) { $mutations = [$this->operation->deleteMutation($table, $keySet)]; return $this->commitInSingleUseTransaction($mutations, $options); }
[ "public", "function", "delete", "(", "$", "table", ",", "KeySet", "$", "keySet", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "mutations", "=", "[", "$", "this", "->", "operation", "->", "deleteMutation", "(", "$", "table", ",", "$", "keySet", ")", "]", ";", "return", "$", "this", "->", "commitInSingleUseTransaction", "(", "$", "mutations", ",", "$", "options", ")", ";", "}" ]
Delete one or more rows. Mutations are committed in a single-use transaction. Since this method does not feature replay protection, it may attempt to apply mutations more than once; if the mutations are not idempotent, this may lead to a failure being reported when the mutation was previously applied. Example: ``` $keySet = new KeySet([ 'keys' => [ 1337, 1338 ] ]); $database->delete('Posts', $keySet); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.CommitRequest CommitRequest @codingStandardsIgnoreEnd @param string $table The table to mutate. @param KeySet $keySet The KeySet to identify rows to delete. @param array $options [optional] Configuration options. @return Timestamp The commit Timestamp.
[ "Delete", "one", "or", "more", "rows", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1112-L1117
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.executePartitionedUpdate
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
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(); } }
[ "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", "(", ")", ";", "}", "}" ]
Execute a partitioned DML update. Returns the lower bound of rows modified by the DML statement. **PLEASE NOTE** Most use cases for DML are better served by using {@see Google\Cloud\Spanner\Transaction::executeUpdate()}. Please read and understand the documentation for partitioned DML before implementing it in your application. Data Manipulation Language (DML) allows you to execute statements which modify the state of the database (i.e. inserting, updating or deleting rows). To execute a SELECT statement, use {@see Google\Cloud\Spanner\Database::execute()}. The method will block until the update is complete. Running a DML statement with this method does not offer exactly once semantics, and therefore the DML statement should be idempotent. The DML statement must be fully-partitionable. Specifically, the statement must be expressible as the union of many statements which each access only a single row of the table. Partitioned DML partitions the key space and runs the DML statement over each partition in parallel using separate, internal transactions that commit independently. Partitioned DML is good fit for large, database-wide, operations that are idempotent. Partitioned DML enables large-scale changes without running into transaction size limits or accidentally locking the entire table in one large transaction. Smaller scoped statements, such as an OLTP workload, should prefer using {@see Google\Cloud\Spanner\Transaction::executeUpdate()}. * The DML statement must be fully-partitionable. Specifically, the statement must be expressible as the union of many statements which each access only a single row of the table. * The statement is not applied atomically to all rows of the table. Rather, the statement is applied atomically to partitions of the table, in independent internal transactions. Secondary index rows are updated atomically with the base table rows. * Partitioned DML does not guarantee exactly-once execution semantics against a partition. The statement will be applied at least once to each partition. It is strongly recommended that the DML statement should be idempotent to avoid unexpected results. For instance, it is potentially dangerous to run a statement such as `UPDATE table SET column = column + 1` as it could be run multiple times against some rows. * The partitions are committed automatically - there is no support for Commit or Rollback. If the call returns an error, or if the client issuing the DML statement dies, it is possible that some rows had the statement executed on them successfully. It is also possible that the statement was never executed against other rows. * If any error is encountered during the execution of the partitioned DML operation (for instance, a UNIQUE INDEX violation, division by zero, or a value that cannot be stored due to schema constraints), then the operation is stopped at that point and an error is returned. It is possible that at this point, some partitions have been committed (or even committed multiple times), and other partitions have not been run at all. Given the above, Partitioned DML is good fit for large, database-wide, operations that are idempotent, such as deleting old rows from a very large table. Please refer to the TransactionOptions documentation referenced below in order to fully understand the semantics and intended use case for partitioned DML updates. Example: ``` use Google\Cloud\Spanner\Date; $deactivatedUserCount = $database->executePartitionedUpdate( 'UPDATE Users u SET u.activeSubscription = false, u.subscriptionEndDate = @date ' . 'WHERE TIMESTAMP_DIFF(CURRENT_TIMESTAMP(), u.lastBillDate, DAY) > 365', [ 'parameters' => [ 'date' => new Date(new \DateTime) ] ] ); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.TransactionOptions TransactionOptions @see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.ExecuteSqlRequest ExecuteSqlRequest @codingStandardsIgnoreEnd @param string $statement The DML statement to execute. @param array $options [optional] { Configuration Options. @type array $parameters A key/value array of Query Parameters, where the key is represented in the statement prefixed by a `@` symbol. @type array $types A key/value array of Query Parameter types. Generally, Google Cloud PHP can infer types. Explicit type declarations are required in the case of struct parameters, or when a null value exists as a parameter. Accepted values for primitive types are defined as constants on {@see Google\Cloud\Spanner\Database}, and are as follows: `Database::TYPE_BOOL`, `Database::TYPE_INT64`, `Database::TYPE_FLOAT64`, `Database::TYPE_TIMESTAMP`, `Database::TYPE_DATE`, `Database::TYPE_STRING`, `Database::TYPE_BYTES`. If the value is an array, use {@see Google\Cloud\Spanner\ArrayType} to declare the array parameter types. Likewise, for structs, use {@see Google\Cloud\Spanner\StructType}. } @return int The number of rows modified.
[ "Execute", "a", "partitioned", "DML", "update", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1479-L1496
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.close
public function close() { if ($this->session) { if ($this->sessionPool) { $this->sessionPool->release($this->session); } else { $this->session->delete(); } $this->session = null; } }
php
public function close() { if ($this->session) { if ($this->sessionPool) { $this->sessionPool->release($this->session); } else { $this->session->delete(); } $this->session = null; } }
[ "public", "function", "close", "(", ")", "{", "if", "(", "$", "this", "->", "session", ")", "{", "if", "(", "$", "this", "->", "sessionPool", ")", "{", "$", "this", "->", "sessionPool", "->", "release", "(", "$", "this", "->", "session", ")", ";", "}", "else", "{", "$", "this", "->", "session", "->", "delete", "(", ")", ";", "}", "$", "this", "->", "session", "=", "null", ";", "}", "}" ]
Closes the database connection by returning the active session back to the session pool queue or by deleting the session if there is no pool associated. It is highly important to ensure this is called as it is not always safe to rely soley on {@see Google\Cloud\Spanner\Database::__destruct()}. Example: ``` $database->close(); ```
[ "Closes", "the", "database", "connection", "by", "returning", "the", "active", "session", "back", "to", "the", "session", "pool", "queue", "or", "by", "deleting", "the", "session", "if", "there", "is", "no", "pool", "associated", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1651-L1662
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.identity
public function identity() { $databaseParts = explode('/', $this->name); $instanceParts = explode('/', $this->instance->name()); return [ 'projectId' => $this->projectId, 'database' => end($databaseParts), 'instance' => end($instanceParts), ]; }
php
public function identity() { $databaseParts = explode('/', $this->name); $instanceParts = explode('/', $this->instance->name()); return [ 'projectId' => $this->projectId, 'database' => end($databaseParts), 'instance' => end($instanceParts), ]; }
[ "public", "function", "identity", "(", ")", "{", "$", "databaseParts", "=", "explode", "(", "'/'", ",", "$", "this", "->", "name", ")", ";", "$", "instanceParts", "=", "explode", "(", "'/'", ",", "$", "this", "->", "instance", "->", "name", "(", ")", ")", ";", "return", "[", "'projectId'", "=>", "$", "this", "->", "projectId", ",", "'database'", "=>", "end", "(", "$", "databaseParts", ")", ",", "'instance'", "=>", "end", "(", "$", "instanceParts", ")", ",", "]", ";", "}" ]
Retrieves the database's identity. @access private @return array
[ "Retrieves", "the", "database", "s", "identity", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1716-L1726
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.selectSession
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
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); }
[ "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", ")", ";", "}" ]
If no session is already associated with the database use the session pool implementation to retrieve a session one - otherwise create on demand. @param string $context [optional] The session context. **Defaults to** `r` (READ). @param array $options [optional] Configuration options. @return Session
[ "If", "no", "session", "is", "already", "associated", "with", "the", "database", "use", "the", "session", "pool", "implementation", "to", "retrieve", "a", "session", "one", "-", "otherwise", "create", "on", "demand", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1768-L1779
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.commitInSingleUseTransaction
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
private function commitInSingleUseTransaction(array $mutations, array $options = []) { $options['mutations'] = $mutations; return $this->runTransaction(function (Transaction $t) use ($options) { return $t->commit($options); }, [ 'singleUse' => true ]); }
[ "private", "function", "commitInSingleUseTransaction", "(", "array", "$", "mutations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'mutations'", "]", "=", "$", "mutations", ";", "return", "$", "this", "->", "runTransaction", "(", "function", "(", "Transaction", "$", "t", ")", "use", "(", "$", "options", ")", "{", "return", "$", "t", "->", "commit", "(", "$", "options", ")", ";", "}", ",", "[", "'singleUse'", "=>", "true", "]", ")", ";", "}" ]
Common method to run mutations within a single-use transaction. @param array $mutations A list of mutations to execute. @param array $options [optional] Configuration options. @return Timestamp The commit timestamp.
[ "Common", "method", "to", "run", "mutations", "within", "a", "single", "-", "use", "transaction", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1788-L1797
train
googleapis/google-cloud-php
Spanner/src/Database.php
Database.fullyQualifiedDatabaseName
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
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 }
[ "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", "}" ]
Convert the simple database name to a fully qualified name. @return string
[ "Convert", "the", "simple", "database", "name", "to", "a", "fully", "qualified", "name", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Database.php#L1804-L1819
train
googleapis/google-cloud-php
Core/src/Compute/Metadata/Readers/StreamReader.php
StreamReader.read
public function read($path) { $url = self::BASE_URL.$path; return file_get_contents($url, false, $this->context); }
php
public function read($path) { $url = self::BASE_URL.$path; return file_get_contents($url, false, $this->context); }
[ "public", "function", "read", "(", "$", "path", ")", "{", "$", "url", "=", "self", "::", "BASE_URL", ".", "$", "path", ";", "return", "file_get_contents", "(", "$", "url", ",", "false", ",", "$", "this", "->", "context", ")", ";", "}" ]
A method to read the metadata value for a given path.
[ "A", "method", "to", "read", "the", "metadata", "value", "for", "a", "given", "path", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Compute/Metadata/Readers/StreamReader.php#L59-L63
train
googleapis/google-cloud-php
Core/src/Report/MetadataProviderUtils.php
MetadataProviderUtils.autoSelect
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
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(); }
[ "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", "(", ")", ";", "}" ]
Automatically choose the most appropriate MetadataProvider and return it. @param array $server Normally pass the $_SERVER. @return MetadataProviderInterface
[ "Automatically", "choose", "the", "most", "appropriate", "MetadataProvider", "and", "return", "it", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Report/MetadataProviderUtils.php#L31-L40
train
googleapis/google-cloud-php
BigQueryDataTransfer/src/V1/TransferMessage.php
TransferMessage.setSeverity
public function setSeverity($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity::class); $this->severity = $var; return $this; }
php
public function setSeverity($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity::class); $this->severity = $var; return $this; }
[ "public", "function", "setSeverity", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "BigQuery", "\\", "DataTransfer", "\\", "V1", "\\", "TransferMessage_MessageSeverity", "::", "class", ")", ";", "$", "this", "->", "severity", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Message severity. Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.TransferMessage.MessageSeverity severity = 2;</code> @param int $var @return $this
[ "Message", "severity", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/TransferMessage.php#L100-L106
train
googleapis/google-cloud-php
Dlp/src/V2/PrivacyMetric/KMapEstimationConfig.php
KMapEstimationConfig.setAuxiliaryTables
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
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; }
[ "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", ";", "}" ]
Several auxiliary tables can be used in the analysis. Each custom_tag used to tag a quasi-identifiers column must appear in exactly one column of one auxiliary table. Generated from protobuf field <code>repeated .google.privacy.dlp.v2.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable auxiliary_tables = 3;</code> @param \Google\Cloud\Dlp\V2\PrivacyMetric\KMapEstimationConfig\AuxiliaryTable[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Several", "auxiliary", "tables", "can", "be", "used", "in", "the", "analysis", ".", "Each", "custom_tag", "used", "to", "tag", "a", "quasi", "-", "identifiers", "column", "must", "appear", "in", "exactly", "one", "column", "of", "one", "auxiliary", "table", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/PrivacyMetric/KMapEstimationConfig.php#L152-L158
train
googleapis/google-cloud-php
Container/src/V1/NodeManagement.php
NodeManagement.setUpgradeOptions
public function setUpgradeOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\AutoUpgradeOptions::class); $this->upgrade_options = $var; return $this; }
php
public function setUpgradeOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\AutoUpgradeOptions::class); $this->upgrade_options = $var; return $this; }
[ "public", "function", "setUpgradeOptions", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Container", "\\", "V1", "\\", "AutoUpgradeOptions", "::", "class", ")", ";", "$", "this", "->", "upgrade_options", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Specifies the Auto Upgrade knobs for the node pool. Generated from protobuf field <code>.google.container.v1.AutoUpgradeOptions upgrade_options = 10;</code> @param \Google\Cloud\Container\V1\AutoUpgradeOptions $var @return $this
[ "Specifies", "the", "Auto", "Upgrade", "knobs", "for", "the", "node", "pool", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/NodeManagement.php#L147-L153
train
googleapis/google-cloud-php
Storage/src/ObjectPageIterator.php
ObjectPageIterator.updatePrefixes
private function updatePrefixes() { foreach ($this->page['prefixes'] as $prefix) { if (!in_array($prefix, $this->prefixes)) { $this->prefixes[] = $prefix; } } }
php
private function updatePrefixes() { foreach ($this->page['prefixes'] as $prefix) { if (!in_array($prefix, $this->prefixes)) { $this->prefixes[] = $prefix; } } }
[ "private", "function", "updatePrefixes", "(", ")", "{", "foreach", "(", "$", "this", "->", "page", "[", "'prefixes'", "]", "as", "$", "prefix", ")", "{", "if", "(", "!", "in_array", "(", "$", "prefix", ",", "$", "this", "->", "prefixes", ")", ")", "{", "$", "this", "->", "prefixes", "[", "]", "=", "$", "prefix", ";", "}", "}", "}" ]
Add new prefixes to the list. @return array
[ "Add", "new", "prefixes", "to", "the", "list", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/ObjectPageIterator.php#L69-L76
train
googleapis/google-cloud-php
Dataproc/src/V1/Job.php
Job.setPlacement
public function setPlacement($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobPlacement::class); $this->placement = $var; return $this; }
php
public function setPlacement($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobPlacement::class); $this->placement = $var; return $this; }
[ "public", "function", "setPlacement", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dataproc", "\\", "V1", "\\", "JobPlacement", "::", "class", ")", ";", "$", "this", "->", "placement", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Required. Job information, including how, when, and where to run the job. Generated from protobuf field <code>.google.cloud.dataproc.v1.JobPlacement placement = 2;</code> @param \Google\Cloud\Dataproc\V1\JobPlacement $var @return $this
[ "Required", ".", "Job", "information", "including", "how", "when", "and", "where", "to", "run", "the", "job", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/Job.php#L215-L221
train
googleapis/google-cloud-php
Dataproc/src/V1/Job.php
Job.setHiveJob
public function setHiveJob($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\HiveJob::class); $this->writeOneof(6, $var); return $this; }
php
public function setHiveJob($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\HiveJob::class); $this->writeOneof(6, $var); return $this; }
[ "public", "function", "setHiveJob", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dataproc", "\\", "V1", "\\", "HiveJob", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "6", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Job is a Hive job. Generated from protobuf field <code>.google.cloud.dataproc.v1.HiveJob hive_job = 6;</code> @param \Google\Cloud\Dataproc\V1\HiveJob $var @return $this
[ "Job", "is", "a", "Hive", "job", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/Job.php#L319-L325
train
googleapis/google-cloud-php
Dataproc/src/V1/Job.php
Job.setPigJob
public function setPigJob($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\PigJob::class); $this->writeOneof(7, $var); return $this; }
php
public function setPigJob($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\PigJob::class); $this->writeOneof(7, $var); return $this; }
[ "public", "function", "setPigJob", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dataproc", "\\", "V1", "\\", "PigJob", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "7", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Job is a Pig job. Generated from protobuf field <code>.google.cloud.dataproc.v1.PigJob pig_job = 7;</code> @param \Google\Cloud\Dataproc\V1\PigJob $var @return $this
[ "Job", "is", "a", "Pig", "job", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/Job.php#L345-L351
train
googleapis/google-cloud-php
Dataproc/src/V1/Job.php
Job.setScheduling
public function setScheduling($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobScheduling::class); $this->scheduling = $var; return $this; }
php
public function setScheduling($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\JobScheduling::class); $this->scheduling = $var; return $this; }
[ "public", "function", "setScheduling", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dataproc", "\\", "V1", "\\", "JobScheduling", "::", "class", ")", ";", "$", "this", "->", "scheduling", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. Job scheduling configuration. Generated from protobuf field <code>.google.cloud.dataproc.v1.JobScheduling scheduling = 20;</code> @param \Google\Cloud\Dataproc\V1\JobScheduling $var @return $this
[ "Optional", ".", "Job", "scheduling", "configuration", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/Job.php#L579-L585
train
googleapis/google-cloud-php
VideoIntelligence/src/V1beta2/VideoAnnotationResults.php
VideoAnnotationResults.setSegmentLabelAnnotations
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
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; }
[ "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", ";", "}" ]
Label annotations on video level or user specified segment level. There is exactly one element for each unique label. Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation segment_label_annotations = 2;</code> @param \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Label", "annotations", "on", "video", "level", "or", "user", "specified", "segment", "level", ".", "There", "is", "exactly", "one", "element", "for", "each", "unique", "label", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1beta2/VideoAnnotationResults.php#L154-L160
train
googleapis/google-cloud-php
VideoIntelligence/src/V1beta2/VideoAnnotationResults.php
VideoAnnotationResults.setShotLabelAnnotations
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
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; }
[ "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", ";", "}" ]
Label annotations on shot level. There is exactly one element for each unique label. Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation shot_label_annotations = 3;</code> @param \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Label", "annotations", "on", "shot", "level", ".", "There", "is", "exactly", "one", "element", "for", "each", "unique", "label", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1beta2/VideoAnnotationResults.php#L182-L188
train
googleapis/google-cloud-php
Bigtable/src/ResumableStream.php
ResumableStream.readAll
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
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; } }
[ "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", ";", "}", "}" ]
Starts executing the call and reading elements from server stream. @return \Generator @throws ApiException
[ "Starts", "executing", "the", "call", "and", "reading", "elements", "from", "server", "stream", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/ResumableStream.php#L89-L108
train
googleapis/google-cloud-php
VideoIntelligence/src/V1beta2/VideoContext.php
VideoContext.setSegments
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
public function setSegments($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class); $this->segments = $arr; return $this; }
[ "public", "function", "setSegments", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "VideoIntelligence", "\\", "V1beta2", "\\", "VideoSegment", "::", "class", ")", ";", "$", "this", "->", "segments", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Video segments to annotate. The segments may overlap and are not required to be contiguous or span the whole video. If unspecified, each video is treated as a single segment. Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1beta2.VideoSegment segments = 1;</code> @param \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Video", "segments", "to", "annotate", ".", "The", "segments", "may", "overlap", "and", "are", "not", "required", "to", "be", "contiguous", "or", "span", "the", "whole", "video", ".", "If", "unspecified", "each", "video", "is", "treated", "as", "a", "single", "segment", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1beta2/VideoContext.php#L98-L104
train
googleapis/google-cloud-php
VideoIntelligence/src/V1beta2/VideoContext.php
VideoContext.setLabelDetectionConfig
public function setLabelDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig::class); $this->label_detection_config = $var; return $this; }
php
public function setLabelDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig::class); $this->label_detection_config = $var; return $this; }
[ "public", "function", "setLabelDetectionConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "VideoIntelligence", "\\", "V1beta2", "\\", "LabelDetectionConfig", "::", "class", ")", ";", "$", "this", "->", "label_detection_config", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Config for LABEL_DETECTION. Generated from protobuf field <code>.google.cloud.videointelligence.v1beta2.LabelDetectionConfig label_detection_config = 2;</code> @param \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig $var @return $this
[ "Config", "for", "LABEL_DETECTION", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1beta2/VideoContext.php#L124-L130
train
googleapis/google-cloud-php
VideoIntelligence/src/V1beta2/VideoContext.php
VideoContext.setFaceDetectionConfig
public function setFaceDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig::class); $this->face_detection_config = $var; return $this; }
php
public function setFaceDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig::class); $this->face_detection_config = $var; return $this; }
[ "public", "function", "setFaceDetectionConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "VideoIntelligence", "\\", "V1beta2", "\\", "FaceDetectionConfig", "::", "class", ")", ";", "$", "this", "->", "face_detection_config", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Config for FACE_DETECTION. Generated from protobuf field <code>.google.cloud.videointelligence.v1beta2.FaceDetectionConfig face_detection_config = 5;</code> @param \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig $var @return $this
[ "Config", "for", "FACE_DETECTION", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1beta2/VideoContext.php#L202-L208
train
googleapis/google-cloud-php
Debugger/src/Connection/Grpc.php
Grpc.listDebuggees
public function listDebuggees(array $args = []) { return $this->send([$this->debuggerClient, 'listDebuggees'], [ $this->pluck('project', $args), DebuggerClient::getDefaultAgentVersion(), $args ]); }
php
public function listDebuggees(array $args = []) { return $this->send([$this->debuggerClient, 'listDebuggees'], [ $this->pluck('project', $args), DebuggerClient::getDefaultAgentVersion(), $args ]); }
[ "public", "function", "listDebuggees", "(", "array", "$", "args", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "[", "$", "this", "->", "debuggerClient", ",", "'listDebuggees'", "]", ",", "[", "$", "this", "->", "pluck", "(", "'project'", ",", "$", "args", ")", ",", "DebuggerClient", "::", "getDefaultAgentVersion", "(", ")", ",", "$", "args", "]", ")", ";", "}" ]
List all registered debuggees. @param array $args { @type string $project The project ID }
[ "List", "all", "registered", "debuggees", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Connection/Grpc.php#L95-L102
train
googleapis/google-cloud-php
Debugger/src/Connection/Grpc.php
Grpc.registerDebuggee
public function registerDebuggee(array $args = []) { return $this->send([$this->controllerClient, 'registerDebuggee'], [ $this->serializer->decodeMessage( new Debuggee(), $this->pluck('debuggee', $args) ), $args ]); }
php
public function registerDebuggee(array $args = []) { return $this->send([$this->controllerClient, 'registerDebuggee'], [ $this->serializer->decodeMessage( new Debuggee(), $this->pluck('debuggee', $args) ), $args ]); }
[ "public", "function", "registerDebuggee", "(", "array", "$", "args", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "[", "$", "this", "->", "controllerClient", ",", "'registerDebuggee'", "]", ",", "[", "$", "this", "->", "serializer", "->", "decodeMessage", "(", "new", "Debuggee", "(", ")", ",", "$", "this", "->", "pluck", "(", "'debuggee'", ",", "$", "args", ")", ")", ",", "$", "args", "]", ")", ";", "}" ]
Register this process as a debuggee. @param array $args
[ "Register", "this", "process", "as", "a", "debuggee", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Connection/Grpc.php#L109-L118
train
googleapis/google-cloud-php
Debugger/src/Connection/Grpc.php
Grpc.listBreakpoints
public function listBreakpoints(array $args = []) { return $this->send([$this->controllerClient, 'listActiveBreakpoints'], [ $this->pluck('debuggeeId', $args), $args ]); }
php
public function listBreakpoints(array $args = []) { return $this->send([$this->controllerClient, 'listActiveBreakpoints'], [ $this->pluck('debuggeeId', $args), $args ]); }
[ "public", "function", "listBreakpoints", "(", "array", "$", "args", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "[", "$", "this", "->", "controllerClient", ",", "'listActiveBreakpoints'", "]", ",", "[", "$", "this", "->", "pluck", "(", "'debuggeeId'", ",", "$", "args", ")", ",", "$", "args", "]", ")", ";", "}" ]
List the breakpoints set for the specified debuggee. @param array $args
[ "List", "the", "breakpoints", "set", "for", "the", "specified", "debuggee", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Connection/Grpc.php#L125-L131
train
googleapis/google-cloud-php
Debugger/src/Connection/Grpc.php
Grpc.updateBreakpoint
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
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 ]); }
[ "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", "]", ")", ";", "}" ]
Update the provided breakpoint. @param array $args
[ "Update", "the", "provided", "breakpoint", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Connection/Grpc.php#L138-L148
train
googleapis/google-cloud-php
Debugger/src/Connection/Grpc.php
Grpc.setBreakpoint
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
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 ]); }
[ "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", "]", ")", ";", "}" ]
Sets a breakpoint. @param array $args { @type string $debuggeeId The Debuggee ID @type array $location The source location } @return array
[ "Sets", "a", "breakpoint", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Connection/Grpc.php#L159-L175
train
googleapis/google-cloud-php
ErrorReporting/src/V1beta1/ListEventsResponse.php
ListEventsResponse.setErrorEvents
public function setErrorEvents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class); $this->error_events = $arr; return $this; }
php
public function setErrorEvents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class); $this->error_events = $arr; return $this; }
[ "public", "function", "setErrorEvents", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "ErrorReporting", "\\", "V1beta1", "\\", "ErrorEvent", "::", "class", ")", ";", "$", "this", "->", "error_events", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The error events which match the given request. Generated from protobuf field <code>repeated .google.devtools.clouderrorreporting.v1beta1.ErrorEvent error_events = 1;</code> @param \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "error", "events", "which", "match", "the", "given", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/ErrorReporting/src/V1beta1/ListEventsResponse.php#L78-L84
train
googleapis/google-cloud-php
Dlp/src/V2/InspectionRuleSet.php
InspectionRuleSet.setRules
public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InspectionRule::class); $this->rules = $arr; return $this; }
php
public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InspectionRule::class); $this->rules = $arr; return $this; }
[ "public", "function", "setRules", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "InspectionRule", "::", "class", ")", ";", "$", "this", "->", "rules", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Set of rules to be applied to infoTypes. The rules are applied in order. Generated from protobuf field <code>repeated .google.privacy.dlp.v2.InspectionRule rules = 2;</code> @param \Google\Cloud\Dlp\V2\InspectionRule[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Set", "of", "rules", "to", "be", "applied", "to", "infoTypes", ".", "The", "rules", "are", "applied", "in", "order", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectionRuleSet.php#L93-L99
train
googleapis/google-cloud-php
Talent/src/V4beta1/PersonName/PersonStructuredName.php
PersonStructuredName.setSuffixes
public function setSuffixes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->suffixes = $arr; return $this; }
php
public function setSuffixes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->suffixes = $arr; return $this; }
[ "public", "function", "setSuffixes", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "suffixes", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. Suffixes. Number of characters allowed is 20. Generated from protobuf field <code>repeated string suffixes = 4;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "Suffixes", ".", "Number", "of", "characters", "allowed", "is", "20", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/PersonName/PersonStructuredName.php#L240-L246
train
googleapis/google-cloud-php
Talent/src/V4beta1/PersonName/PersonStructuredName.php
PersonStructuredName.setPrefixes
public function setPrefixes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->prefixes = $arr; return $this; }
php
public function setPrefixes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->prefixes = $arr; return $this; }
[ "public", "function", "setPrefixes", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "prefixes", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. Prefixes. Number of characters allowed is 20. Generated from protobuf field <code>repeated string prefixes = 5;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "Prefixes", ".", "Number", "of", "characters", "allowed", "is", "20", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/PersonName/PersonStructuredName.php#L270-L276
train
googleapis/google-cloud-php
Redis/src/V1/UpdateInstanceRequest.php
UpdateInstanceRequest.setInstance
public function setInstance($var) { GPBUtil::checkMessage($var, \Google\Cloud\Redis\V1\Instance::class); $this->instance = $var; return $this; }
php
public function setInstance($var) { GPBUtil::checkMessage($var, \Google\Cloud\Redis\V1\Instance::class); $this->instance = $var; return $this; }
[ "public", "function", "setInstance", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Redis", "\\", "V1", "\\", "Instance", "::", "class", ")", ";", "$", "this", "->", "instance", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Required. Update description. Only fields specified in update_mask are updated. Generated from protobuf field <code>.google.cloud.redis.v1.Instance instance = 2;</code> @param \Google\Cloud\Redis\V1\Instance $var @return $this
[ "Required", ".", "Update", "description", ".", "Only", "fields", "specified", "in", "update_mask", "are", "updated", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1/UpdateInstanceRequest.php#L120-L126
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php
FirestoreGapicClient.anyPathName
public static function anyPathName($project, $database, $document, $anyPath) { return self::getAnyPathNameTemplate()->render([ 'project' => $project, 'database' => $database, 'document' => $document, 'any_path' => $anyPath, ]); }
php
public static function anyPathName($project, $database, $document, $anyPath) { return self::getAnyPathNameTemplate()->render([ 'project' => $project, 'database' => $database, 'document' => $document, 'any_path' => $anyPath, ]); }
[ "public", "static", "function", "anyPathName", "(", "$", "project", ",", "$", "database", ",", "$", "document", ",", "$", "anyPath", ")", "{", "return", "self", "::", "getAnyPathNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'database'", "=>", "$", "database", ",", "'document'", "=>", "$", "document", ",", "'any_path'", "=>", "$", "anyPath", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a any_path resource. @param string $project @param string $database @param string $document @param string $anyPath @return string The formatted any_path resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "any_path", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php#L226-L234
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php
FirestoreGapicClient.documentPathName
public static function documentPathName($project, $database, $documentPath) { return self::getDocumentPathNameTemplate()->render([ 'project' => $project, 'database' => $database, 'document_path' => $documentPath, ]); }
php
public static function documentPathName($project, $database, $documentPath) { return self::getDocumentPathNameTemplate()->render([ 'project' => $project, 'database' => $database, 'document_path' => $documentPath, ]); }
[ "public", "static", "function", "documentPathName", "(", "$", "project", ",", "$", "database", ",", "$", "documentPath", ")", "{", "return", "self", "::", "getDocumentPathNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'database'", "=>", "$", "database", ",", "'document_path'", "=>", "$", "documentPath", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a document_path resource. @param string $project @param string $database @param string $documentPath @return string The formatted document_path resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "document_path", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php#L265-L272
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php
FirestoreGapicClient.commit
public function commit($database, $writes, array $optionalArgs = []) { $request = new CommitRequest(); $request->setDatabase($database); $request->setWrites($writes); if (isset($optionalArgs['transaction'])) { $request->setTransaction($optionalArgs['transaction']); } $requestParams = new RequestParamsHeaderDescriptor([ 'database' => $request->getDatabase(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'Commit', CommitResponse::class, $optionalArgs, $request )->wait(); }
php
public function commit($database, $writes, array $optionalArgs = []) { $request = new CommitRequest(); $request->setDatabase($database); $request->setWrites($writes); if (isset($optionalArgs['transaction'])) { $request->setTransaction($optionalArgs['transaction']); } $requestParams = new RequestParamsHeaderDescriptor([ 'database' => $request->getDatabase(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'Commit', CommitResponse::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "commit", "(", "$", "database", ",", "$", "writes", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "CommitRequest", "(", ")", ";", "$", "request", "->", "setDatabase", "(", "$", "database", ")", ";", "$", "request", "->", "setWrites", "(", "$", "writes", ")", ";", "if", "(", "isset", "(", "$", "optionalArgs", "[", "'transaction'", "]", ")", ")", "{", "$", "request", "->", "setTransaction", "(", "$", "optionalArgs", "[", "'transaction'", "]", ")", ";", "}", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'database'", "=>", "$", "request", "->", "getDatabase", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'Commit'", ",", "CommitResponse", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Commits a transaction, while optionally updating documents. Sample code: ``` $firestoreClient = new FirestoreClient(); try { $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]'); $writes = []; $response = $firestoreClient->commit($formattedDatabase, $writes); } finally { $firestoreClient->close(); } ``` @param string $database The database name. In the format: `projects/{project_id}/databases/{database_id}`. @param Write[] $writes The writes to apply. Always executed atomically and in order. @param array $optionalArgs { Optional. @type string $transaction If set, applies all writes in this transaction, and commits it. @type RetrySettings|array $retrySettings Retry settings to use for this call. Can be a {@see Google\ApiCore\RetrySettings} object, or an associative array of retry settings parameters. See the documentation on {@see Google\ApiCore\RetrySettings} for example usage. } @return \Google\Cloud\Firestore\V1beta1\CommitResponse @throws ApiException if the remote call fails @experimental
[ "Commits", "a", "transaction", "while", "optionally", "updating", "documents", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php#L957-L979
train
googleapis/google-cloud-php
Core/src/Batch/SimpleJobTrait.php
SimpleJobTrait.setSimpleJobProperties
private function setSimpleJobProperties(array $options = []) { if (!isset($options['identifier'])) { throw new \InvalidArgumentException( 'A valid identifier is required in order to register a job.' ); } $options += [ 'configStorage' => null, ]; $this->setSerializableClientOptions($options); $identifier = $options['identifier']; $configStorage = $options['configStorage'] ?: $this->defaultConfigStorage(); $result = $configStorage->lock(); if ($result === false) { return false; } $config = $configStorage->load(); $config->registerJob( $identifier, function ($id) use ($identifier, $options) { return new SimpleJob($identifier, [$this, 'run'], $id, $options); } ); try { $result = $configStorage->save($config); } finally { $configStorage->unlock(); } return $result; }
php
private function setSimpleJobProperties(array $options = []) { if (!isset($options['identifier'])) { throw new \InvalidArgumentException( 'A valid identifier is required in order to register a job.' ); } $options += [ 'configStorage' => null, ]; $this->setSerializableClientOptions($options); $identifier = $options['identifier']; $configStorage = $options['configStorage'] ?: $this->defaultConfigStorage(); $result = $configStorage->lock(); if ($result === false) { return false; } $config = $configStorage->load(); $config->registerJob( $identifier, function ($id) use ($identifier, $options) { return new SimpleJob($identifier, [$this, 'run'], $id, $options); } ); try { $result = $configStorage->save($config); } finally { $configStorage->unlock(); } return $result; }
[ "private", "function", "setSimpleJobProperties", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'identifier'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'A valid identifier is required in order to register a job.'", ")", ";", "}", "$", "options", "+=", "[", "'configStorage'", "=>", "null", ",", "]", ";", "$", "this", "->", "setSerializableClientOptions", "(", "$", "options", ")", ";", "$", "identifier", "=", "$", "options", "[", "'identifier'", "]", ";", "$", "configStorage", "=", "$", "options", "[", "'configStorage'", "]", "?", ":", "$", "this", "->", "defaultConfigStorage", "(", ")", ";", "$", "result", "=", "$", "configStorage", "->", "lock", "(", ")", ";", "if", "(", "$", "result", "===", "false", ")", "{", "return", "false", ";", "}", "$", "config", "=", "$", "configStorage", "->", "load", "(", ")", ";", "$", "config", "->", "registerJob", "(", "$", "identifier", ",", "function", "(", "$", "id", ")", "use", "(", "$", "identifier", ",", "$", "options", ")", "{", "return", "new", "SimpleJob", "(", "$", "identifier", ",", "[", "$", "this", ",", "'run'", "]", ",", "$", "id", ",", "$", "options", ")", ";", "}", ")", ";", "try", "{", "$", "result", "=", "$", "configStorage", "->", "save", "(", "$", "config", ")", ";", "}", "finally", "{", "$", "configStorage", "->", "unlock", "(", ")", ";", "}", "return", "$", "result", ";", "}" ]
Registers this object as a SimpleJob. @param array $options [optional] { Configuration options. @type string $identifier An identifier for the simple job. This value must be unique across all job configs. @type ConfigStorageInterface $configStorage The configuration storage used to save configuration. @type int $numWorkers The number of workers for this job. @type array $clientConfig A config used to construct the client upon which requests will be made. @type ClosureSerializerInterface $closureSerializer An implementation responsible for serializing closures used in the `$clientConfig`. This is especially important when using the batch daemon. **Defaults to** {@see Google\Cloud\Core\Batch\OpisClosureSerializer} if the `opis/closure` library is installed. }
[ "Registers", "this", "object", "as", "a", "SimpleJob", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/SimpleJobTrait.php#L62-L95
train
googleapis/google-cloud-php
Logging/src/LoggingClient.php
LoggingClient.psrBatchLogger
public static function psrBatchLogger($name, array $options = []) { $client = array_key_exists('clientConfig', $options) ? new self($options['clientConfig']) : new self(); // Force enabling batch. $options['batchEnabled'] = true; return $client->psrLogger($name, $options); }
php
public static function psrBatchLogger($name, array $options = []) { $client = array_key_exists('clientConfig', $options) ? new self($options['clientConfig']) : new self(); // Force enabling batch. $options['batchEnabled'] = true; return $client->psrLogger($name, $options); }
[ "public", "static", "function", "psrBatchLogger", "(", "$", "name", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "client", "=", "array_key_exists", "(", "'clientConfig'", ",", "$", "options", ")", "?", "new", "self", "(", "$", "options", "[", "'clientConfig'", "]", ")", ":", "new", "self", "(", ")", ";", "// Force enabling batch.", "$", "options", "[", "'batchEnabled'", "]", "=", "true", ";", "return", "$", "client", "->", "psrLogger", "(", "$", "name", ",", "$", "options", ")", ";", "}" ]
Create a PsrLogger with batching enabled. @param string $name The name of the log to write entries to. @param array $options [optional] { Configuration options. @type string $messageKey The key in the `jsonPayload` used to contain the logged message. **Defaults to** `message`. @type array $resource The [monitored resource](https://cloud.google.com/logging/docs/api/reference/rest/v2/MonitoredResource) to associate log entries with. **Defaults to** type global. @type array $labels A set of user-defined (key, value) data that provides additional information about the log entry. @type MetadataProviderInterface $metadataProvider **Defaults to** An automatically chosen provider, based on detected environment settings. @type bool $debugOutput Whether or not to output debug information. Please note debug output currently only applies in CLI based applications. **Defaults to** `false`. @type array $batchOptions A set of options for a BatchJob. {@see \Google\Cloud\Core\Batch\BatchJob::__construct()} for more details. **Defaults to** ['batchSize' => 1000, 'callPeriod' => 2.0, 'numWorkers' => 2]. @type array $clientConfig Configuration options for the Logging client used to handle processing of batch items. For valid options please see {@see \Google\Cloud\Logging\LoggingClient::__construct()}. @type BatchRunner $batchRunner A BatchRunner object. Mainly used for the tests to inject a mock. **Defaults to** a newly created BatchRunner. @type ClosureSerializerInterface $closureSerializer An implementation responsible for serializing closures used in the `$clientConfig`. This is especially important when using the batch daemon. **Defaults to** {@see Google\Cloud\Core\Batch\OpisClosureSerializer} if the `opis/closure` library is installed. } @return PsrLogger @experimental The experimental flag means that while we believe this method or class is ready for use, it may change before release in backwards- incompatible ways. Please use with caution, and test thoroughly when upgrading.
[ "Create", "a", "PsrLogger", "with", "batching", "enabled", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/LoggingClient.php#L140-L148
train
googleapis/google-cloud-php
Logging/src/LoggingClient.php
LoggingClient.createSink
public function createSink($name, $destination, array $options = []) { $response = $this->connection->createSink($options + [ 'parent' => $this->formattedProjectName, 'name' => $name, 'destination' => $destination, 'outputVersionFormat' => 'VERSION_FORMAT_UNSPECIFIED' ]); return new Sink($this->connection, $name, $this->projectId, $response); }
php
public function createSink($name, $destination, array $options = []) { $response = $this->connection->createSink($options + [ 'parent' => $this->formattedProjectName, 'name' => $name, 'destination' => $destination, 'outputVersionFormat' => 'VERSION_FORMAT_UNSPECIFIED' ]); return new Sink($this->connection, $name, $this->projectId, $response); }
[ "public", "function", "createSink", "(", "$", "name", ",", "$", "destination", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "connection", "->", "createSink", "(", "$", "options", "+", "[", "'parent'", "=>", "$", "this", "->", "formattedProjectName", ",", "'name'", "=>", "$", "name", ",", "'destination'", "=>", "$", "destination", ",", "'outputVersionFormat'", "=>", "'VERSION_FORMAT_UNSPECIFIED'", "]", ")", ";", "return", "new", "Sink", "(", "$", "this", "->", "connection", ",", "$", "name", ",", "$", "this", "->", "projectId", ",", "$", "response", ")", ";", "}" ]
Create a sink. Example: ``` $sink = $logging->createSink('my-sink', 'storage.googleapis.com/my-bucket'); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/create projects.sinks create API documentation. @codingStandardsIgnoreEnd @param string $name The name of the sink. @param string $destination The export destination. Please see [Exporting Logs With Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs#about_sinks) for more information and examples. @param array $options [optional] { Configuration options. @type string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters). @type string $outputVersionFormat The log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Stackdriver Logging. May be either `V1` or `V2`. **Defaults to** `V2`. } @return Sink
[ "Create", "a", "sink", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/LoggingClient.php#L227-L237
train
googleapis/google-cloud-php
Logging/src/LoggingClient.php
LoggingClient.sinks
public function sinks(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $sink) { return new Sink($this->connection, $sink['name'], $this->projectId, $sink); }, [$this->connection, 'listSinks'], $options + ['parent' => $this->formattedProjectName], [ 'itemsKey' => 'sinks', 'resultLimit' => $resultLimit ] ) ); }
php
public function sinks(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $sink) { return new Sink($this->connection, $sink['name'], $this->projectId, $sink); }, [$this->connection, 'listSinks'], $options + ['parent' => $this->formattedProjectName], [ 'itemsKey' => 'sinks', 'resultLimit' => $resultLimit ] ) ); }
[ "public", "function", "sinks", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resultLimit", "=", "$", "this", "->", "pluck", "(", "'resultLimit'", ",", "$", "options", ",", "false", ")", ";", "return", "new", "ItemIterator", "(", "new", "PageIterator", "(", "function", "(", "array", "$", "sink", ")", "{", "return", "new", "Sink", "(", "$", "this", "->", "connection", ",", "$", "sink", "[", "'name'", "]", ",", "$", "this", "->", "projectId", ",", "$", "sink", ")", ";", "}", ",", "[", "$", "this", "->", "connection", ",", "'listSinks'", "]", ",", "$", "options", "+", "[", "'parent'", "=>", "$", "this", "->", "formattedProjectName", "]", ",", "[", "'itemsKey'", "=>", "'sinks'", ",", "'resultLimit'", "=>", "$", "resultLimit", "]", ")", ")", ";", "}" ]
Fetches sinks associated with your project. Example: ``` $sinks = $logging->sinks(); foreach ($sinks as $sink) { echo $sink->name() . PHP_EOL; } ``` @codingStandardsIgnoreStart @see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/list projects.sinks list API documentation. @codingStandardsIgnoreEnd @param array $options [optional] { Configuration options. @type int $pageSize The maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<Sink>
[ "Fetches", "sinks", "associated", "with", "your", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/LoggingClient.php#L286-L303
train
googleapis/google-cloud-php
Logging/src/LoggingClient.php
LoggingClient.createMetric
public function createMetric($name, $filter, array $options = []) { $response = $this->connection->createMetric($options + [ 'parent' => $this->formattedProjectName, 'name' => $name, 'filter' => $filter ]); return new Metric($this->connection, $name, $this->projectId, $response); }
php
public function createMetric($name, $filter, array $options = []) { $response = $this->connection->createMetric($options + [ 'parent' => $this->formattedProjectName, 'name' => $name, 'filter' => $filter ]); return new Metric($this->connection, $name, $this->projectId, $response); }
[ "public", "function", "createMetric", "(", "$", "name", ",", "$", "filter", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "connection", "->", "createMetric", "(", "$", "options", "+", "[", "'parent'", "=>", "$", "this", "->", "formattedProjectName", ",", "'name'", "=>", "$", "name", ",", "'filter'", "=>", "$", "filter", "]", ")", ";", "return", "new", "Metric", "(", "$", "this", "->", "connection", ",", "$", "name", ",", "$", "this", "->", "projectId", ",", "$", "response", ")", ";", "}" ]
Create a metric. Example: ``` $metric = $logging->createMetric( 'my-metric', 'logName = projects/my-project/logs/my-log' ); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.metrics/create projects.metrics create API documentation. @codingStandardsIgnoreEnd @param string $name The name of the metric. @param string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters). @param array $options [optional] { Configuration Options. @type string $description A description of the metric. } @return Metric
[ "Create", "a", "metric", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/LoggingClient.php#L329-L338
train
googleapis/google-cloud-php
Logging/src/LoggingClient.php
LoggingClient.metrics
public function metrics(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $metric) { return new Metric($this->connection, $metric['name'], $this->projectId, $metric); }, [$this->connection, 'listMetrics'], $options + ['parent' => $this->formattedProjectName], [ 'itemsKey' => 'metrics', 'resultLimit' => $resultLimit ] ) ); }
php
public function metrics(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $metric) { return new Metric($this->connection, $metric['name'], $this->projectId, $metric); }, [$this->connection, 'listMetrics'], $options + ['parent' => $this->formattedProjectName], [ 'itemsKey' => 'metrics', 'resultLimit' => $resultLimit ] ) ); }
[ "public", "function", "metrics", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resultLimit", "=", "$", "this", "->", "pluck", "(", "'resultLimit'", ",", "$", "options", ",", "false", ")", ";", "return", "new", "ItemIterator", "(", "new", "PageIterator", "(", "function", "(", "array", "$", "metric", ")", "{", "return", "new", "Metric", "(", "$", "this", "->", "connection", ",", "$", "metric", "[", "'name'", "]", ",", "$", "this", "->", "projectId", ",", "$", "metric", ")", ";", "}", ",", "[", "$", "this", "->", "connection", ",", "'listMetrics'", "]", ",", "$", "options", "+", "[", "'parent'", "=>", "$", "this", "->", "formattedProjectName", "]", ",", "[", "'itemsKey'", "=>", "'metrics'", ",", "'resultLimit'", "=>", "$", "resultLimit", "]", ")", ")", ";", "}" ]
Fetches metrics associated with your project. Example: ``` $metrics = $logging->metrics(); foreach ($metrics as $metric) { echo $metric->name() . PHP_EOL; } ``` @codingStandardsIgnoreStart @see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.metrics/list projects.metrics list API documentation. @codingStandardsIgnoreEnd @param array $options [optional] { Configuration options. @type int $pageSize The maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<Metric>
[ "Fetches", "metrics", "associated", "with", "your", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/LoggingClient.php#L387-L404
train