idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
23,800
public DocumentReference getParent ( ) { ResourcePath parent = path . getParent ( ) ; return parent . isDocument ( ) ? new DocumentReference ( firestore , parent ) : null ; }
Returns a DocumentReference to the containing Document if this is a subcollection else null .
23,801
public Iterable < DocumentReference > listDocuments ( ) { ListDocumentsRequest . Builder request = ListDocumentsRequest . newBuilder ( ) ; request . setParent ( path . getParent ( ) . toString ( ) ) ; request . setCollectionId ( this . getId ( ) ) ; request . setMask ( DocumentMask . getDefaultInstance ( ) ) ; request ...
Retrieves the list of documents in this collection .
23,802
public ApiFuture < DocumentReference > add ( final Map < String , Object > fields ) { final DocumentReference documentReference = document ( ) ; ApiFuture < WriteResult > createFuture = documentReference . create ( fields ) ; return ApiFutures . transform ( createFuture , new ApiFunction < WriteResult , DocumentReferen...
Adds a new document to this collection with the specified data assigning it a document ID automatically .
23,803
public ApiFuture < DocumentReference > add ( Object pojo ) { Object converted = CustomClassMapper . convertToPlainJavaTypes ( pojo ) ; if ( ! ( converted instanceof Map ) ) { FirestoreException . invalidState ( "Can't set a document's data to an array or primitive" ) ; } return add ( ( Map < String , Object > ) convert...
Adds a new document to this collection with the specified POJO as contents assigning it a document ID automatically .
23,804
public Page < Bucket > authListBuckets ( ) { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Page < Bucket > buckets = storage . list ( ) ; for ( Bucket bucket : buckets . iterateAll ( ) ) { } return buckets ; }
Example of default auth
23,805
public Bucket enableRequesterPays ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BucketInfo bucketInfo = BucketInfo . newBuilder ( bucketName ) . setRequesterPays ( true ) . build ( ) ; Bucket bucket = storage . update ( bucketInfo ) ; System...
Example of enabling Requester pays on a bucket .
23,806
public Bucket disableRequesterPays ( String bucketName ) { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BucketInfo bucketInfo = BucketInfo . newBuilder ( bucketName ) . setRequesterPays ( false ) . build ( ) ; Bucket bucket = storage . update ( bucketInfo ) ; System . out . println ( "Re...
Example of disabling Requester pays on a bucket .
23,807
public Bucket getRequesterPaysStatus ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , Storage . BucketGetOption . fields ( BucketField . BILLING ) ) ; System . out . println ( "Requester pays status ...
Example of retrieving Requester pays status on a bucket .
23,808
public void downloadFile ( String bucketName , String srcFilename , Path destFilePath ) throws IOException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Blob blob = storage . get ( BlobId . of ( bucketName , srcFilename ) ) ; blob . downloadTo ( destFilePath ) ; }
Example of downloading a file .
23,809
public void downloadFileUsingRequesterPays ( String projectId , String bucketName , String srcFilename , Path destFilePath ) throws IOException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Blob blob = storage . get ( BlobId . of ( bucketName , srcFilename ) ) ; blob . downloadTo ( dest...
Example of downloading a file using Requester pay .
23,810
public Bucket setDefaultKmsKey ( String bucketName , String kmsKeyName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BucketInfo bucketInfo = BucketInfo . newBuilder ( bucketName ) . setDefaultKmsKeyName ( kmsKeyName ) . build ( ) ; Bucket bucket = storage . upd...
Example of setting a default KMS key on a bucket .
23,811
public Bucket setRetentionPolicy ( String bucketName , Long retentionPeriod ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucketWithRetentionPolicy = storage . update ( BucketInfo . newBuilder ( bucketName ) . setRetentionPeriod ( retentionPeriod ) . bui...
Example of setting a retention policy on a bucket
23,812
public Bucket removeRetentionPolicy ( String bucketName ) throws StorageException , IllegalArgumentException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , BucketGetOption . fields ( BucketField . RETENTION_POLICY ) ) ; if ( bucket . retention...
Example of removing a retention policy on a bucket
23,813
public Bucket getRetentionPolicy ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , BucketGetOption . fields ( BucketField . RETENTION_POLICY ) ) ; System . out . println ( "Retention Policy for " + bu...
Example of how to get a bucket s retention policy
23,814
public Bucket lockRetentionPolicy ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , Storage . BucketGetOption . fields ( BucketField . METAGENERATION ) ) ; Bucket lockedBucket = bucket . lockRetention...
Example of how to lock a bucket retention policy
23,815
public Bucket enableDefaultEventBasedHold ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . update ( BucketInfo . newBuilder ( bucketName ) . setDefaultEventBasedHold ( true ) . build ( ) ) ; System . out . println ( "D...
Example of how to enable default event - based hold for a bucket
23,816
public Bucket getDefaultEventBasedHold ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , BucketGetOption . fields ( BucketField . DEFAULT_EVENT_BASED_HOLD ) ) ; if ( bucket . getDefaultEventBasedHold ...
Example of how to get default event - based hold for a bucket
23,817
public Blob setTemporaryHold ( String bucketName , String blobName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BlobId blobId = BlobId . of ( bucketName , blobName ) ; Blob blob = storage . update ( BlobInfo . newBuilder ( blobId ) . setTemporaryHold ( true ) ...
Example of how to set a temporary hold for a blob
23,818
public Bucket enableBucketPolicyOnly ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BucketInfo . IamConfiguration iamConfiguration = BucketInfo . IamConfiguration . newBuilder ( ) . setIsBucketPolicyOnlyEnabled ( true ) . build ( ) ; Bucket b...
Example of how to enable Bucket Policy Only for a bucket
23,819
public Bucket getBucketPolicyOnly ( String bucketName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Bucket bucket = storage . get ( bucketName , BucketGetOption . fields ( BucketField . IAMCONFIGURATION ) ) ; BucketInfo . IamConfiguration iamConfiguration = buc...
Example of how to get Bucket Policy Only metadata for a bucket
23,820
public URL generateV4GetObjectSignedUrl ( String bucketName , String objectName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BlobInfo blobinfo = BlobInfo . newBuilder ( BlobId . of ( bucketName , objectName ) ) . build ( ) ; URL url = storage . signUrl ( blobi...
Example of how to generate a GET V4 Signed URL
23,821
public URL generateV4GPutbjectSignedUrl ( String bucketName , String objectName ) throws StorageException { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; BlobInfo blobinfo = BlobInfo . newBuilder ( BlobId . of ( bucketName , objectName ) ) . build ( ) ; Map < String , String > extensionHe...
Example of how to generate a PUT V4 Signed URL
23,822
public final ClassifyTextResponse classifyText ( Document document ) { ClassifyTextRequest request = ClassifyTextRequest . newBuilder ( ) . setDocument ( document ) . build ( ) ; return classifyText ( request ) ; }
Classifies a document into categories .
23,823
static DatastoreException translateAndThrow ( RetryHelperException ex ) { BaseServiceException . translate ( ex ) ; throw new DatastoreException ( UNKNOWN_CODE , ex . getMessage ( ) , null , ex . getCause ( ) ) ; }
Translate RetryHelperException to the DatastoreException that caused the error . This method will always throw an exception .
23,824
public static FieldMask of ( String ... fieldPaths ) { List < FieldPath > paths = new ArrayList < > ( ) ; for ( String fieldPath : fieldPaths ) { paths . add ( FieldPath . fromDotSeparatedString ( fieldPath ) ) ; } return new FieldMask ( paths ) ; }
Creates a FieldMask from the provided field paths .
23,825
public static Field of ( String name , LegacySQLTypeName type , Field ... subFields ) { return newBuilder ( name , type , subFields ) . build ( ) ; }
Returns a Field object with given name and type .
23,826
public static Builder newBuilder ( String name , LegacySQLTypeName type , Field ... subFields ) { return new Builder ( ) . setName ( name ) . setType ( type , subFields ) ; }
Returns a builder for a Field object with given name and type .
23,827
public void createTable ( ) { if ( ! adminClient . exists ( tableId ) ) { System . out . println ( "Creating table: " + tableId ) ; CreateTableRequest createTableRequest = CreateTableRequest . of ( tableId ) . addFamily ( COLUMN_FAMILY ) ; adminClient . createTable ( createTableRequest ) ; System . out . printf ( "Tabl...
Demonstrates how to create a table .
23,828
public void writeToTable ( ) { try { System . out . println ( "\nWriting some greetings to the table" ) ; String [ ] greetings = { "Hello World!" , "Hello Bigtable!" , "Hello Java!" } ; for ( int i = 0 ; i < greetings . length ; i ++ ) { RowMutation rowMutation = RowMutation . create ( tableId , ROW_KEY_PREFIX + i ) . ...
Demonstrates how to write some rows to a table .
23,829
public void readSingleRow ( ) { try { System . out . println ( "\nReading a single row by row key" ) ; Row row = dataClient . readRow ( tableId , ROW_KEY_PREFIX + 0 ) ; System . out . println ( "Row: " + row . getKey ( ) . toStringUtf8 ( ) ) ; for ( RowCell cell : row . getCells ( ) ) { System . out . printf ( "Family:...
Demonstrates how to read a single row from a table .
23,830
public void readTable ( ) { try { System . out . println ( "\nReading the entire table" ) ; Query query = Query . create ( tableId ) ; ServerStream < Row > rowStream = dataClient . readRows ( query ) ; for ( Row r : rowStream ) { System . out . println ( "Row Key: " + r . getKey ( ) . toStringUtf8 ( ) ) ; for ( RowCell...
Demonstrates how to read an entire table .
23,831
public final Tenant updateTenant ( Tenant tenant ) { UpdateTenantRequest request = UpdateTenantRequest . newBuilder ( ) . setTenant ( tenant ) . build ( ) ; return updateTenant ( request ) ; }
Updates specified tenant .
23,832
public static < T > Map < T , Object > nextRequestOptions ( T pageTokenOption , String cursor , Map < T , ? > optionMap ) { ImmutableMap . Builder < T , Object > builder = ImmutableMap . builder ( ) ; if ( cursor != null ) { builder . put ( pageTokenOption , cursor ) ; } for ( Map . Entry < T , ? > option : optionMap ....
Utility method to construct the options map for the next page request .
23,833
public static JobId of ( String project , String job ) { return newBuilder ( ) . setProject ( checkNotNull ( project ) ) . setJob ( checkNotNull ( job ) ) . build ( ) ; }
Creates a job identity given project s and job s user - defined id .
23,834
public final ImportSshPublicKeyResponse importSshPublicKey ( UserName parent , SshPublicKey sshPublicKey ) { ImportSshPublicKeyRequest request = ImportSshPublicKeyRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setSshPublicKey ( sshPublicKey ) . build ( ) ; return importSshPubli...
Adds an SSH public key and returns the profile information . Default POSIX account information is set when no username and UID exist as part of the login profile .
23,835
public String constructUnsignedPayload ( ) { if ( Storage . SignUrlOption . SignatureVersion . V4 . equals ( signatureVersion ) ) { return constructV4UnsignedPayload ( ) ; } return constructV2UnsignedPayload ( ) ; }
Constructs payload to be signed .
23,836
public static void setCurrentTraceId ( String id ) { if ( id == null ) { traceId . remove ( ) ; } else { traceId . set ( id ) ; } }
Set the Trace ID associated with any logging done by the current thread .
23,837
public static Builder newBuilder ( TableId destinationTable , TableId sourceTable ) { return newBuilder ( destinationTable , ImmutableList . of ( checkNotNull ( sourceTable ) ) ) ; }
Creates a builder for a BigQuery Copy Job configuration given destination and source table .
23,838
public static Builder newBuilder ( TableId destinationTable , List < TableId > sourceTables ) { return new Builder ( ) . setDestinationTable ( destinationTable ) . setSourceTables ( sourceTables ) ; }
Creates a builder for a BigQuery Copy Job configuration given destination and source tables .
23,839
public static CopyJobConfiguration of ( TableId destinationTable , TableId sourceTable ) { return newBuilder ( destinationTable , sourceTable ) . build ( ) ; }
Returns a BigQuery Copy Job configuration for the given destination and source table .
23,840
public static CopyJobConfiguration of ( TableId destinationTable , List < TableId > sourceTables ) { return newBuilder ( destinationTable , sourceTables ) . build ( ) ; }
Returns a BigQuery Copy Job configuration for the given destination and source tables .
23,841
public boolean handleStorageException ( final StorageException exs ) throws StorageException { if ( isRetryable ( exs ) ) { handleRetryForStorageException ( exs ) ; return false ; } if ( isReopenable ( exs ) ) { handleReopenForStorageException ( exs ) ; return true ; } throw exs ; }
Checks whether we should retry reopen or give up .
23,842
private void handleRetryForStorageException ( final StorageException exs ) throws StorageException { retries ++ ; if ( retries > maxRetries ) { throw new StorageException ( exs . getCode ( ) , "All " + maxRetries + " retries failed. Waited a total of " + totalWaitTime + " ms between attempts" , exs ) ; } sleepForAttemp...
Records a retry attempt for the given StorageException sleeping for an amount of time dependent on the attempt number . Throws a StorageException if we ve exhausted all retries .
23,843
private void handleReopenForStorageException ( final StorageException exs ) throws StorageException { reopens ++ ; if ( reopens > maxReopens ) { throw new StorageException ( exs . getCode ( ) , "All " + maxReopens + " reopens failed. Waited a total of " + totalWaitTime + " ms between attempts" , exs ) ; } sleepForAttem...
Records a reopen attempt for the given StorageException sleeping for an amount of time dependent on the attempt number . Throws a StorageException if we ve exhausted all reopens .
23,844
public static Timestamp now ( ) { java . sql . Timestamp date = new java . sql . Timestamp ( System . currentTimeMillis ( ) ) ; return of ( date ) ; }
Creates an instance with current time .
23,845
public Key getParent ( ) { List < PathElement > ancestors = getAncestors ( ) ; if ( ancestors . isEmpty ( ) ) { return null ; } PathElement parent = ancestors . get ( ancestors . size ( ) - 1 ) ; Key . Builder keyBuilder ; if ( parent . hasName ( ) ) { keyBuilder = Key . newBuilder ( getProjectId ( ) , parent . getKind...
Returns the key s parent .
23,846
public EnumT createAndRegister ( String constant ) { EnumT instance = constructor . apply ( constant ) ; knownValues . put ( constant , instance ) ; return instance ; }
Create a new constant and register it in the known values .
23,847
public EnumT valueOfStrict ( String constant ) { EnumT value = knownValues . get ( constant ) ; if ( value != null ) { return value ; } else { throw new IllegalArgumentException ( "Constant \"" + constant + "\" not found for enum \"" + clazz . getName ( ) + "\"" ) ; } }
Get the enum object for the given String constant and throw an exception if the constant is not recognized .
23,848
public EnumT valueOf ( String constant ) { if ( constant == null || constant . isEmpty ( ) ) { throw new IllegalArgumentException ( "Empty enum constants not allowed." ) ; } EnumT value = knownValues . get ( constant ) ; if ( value != null ) { return value ; } else { return constructor . apply ( constant ) ; } }
Get the enum object for the given String constant and allow unrecognized values .
23,849
public EnumT [ ] values ( ) { Collection < EnumT > valueCollection = knownValues . values ( ) ; @ SuppressWarnings ( "unchecked" ) final EnumT [ ] valueArray = ( EnumT [ ] ) Array . newInstance ( clazz , valueCollection . size ( ) ) ; int i = 0 ; for ( EnumT enumV : valueCollection ) { valueArray [ i ] = enumV ; i ++ ;...
Return the known values of this enum type .
23,850
public static final String formatProductName ( String project , String location , String product ) { return PRODUCT_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location , "product" , product ) ; }
Formats a string containing the fully - qualified path to represent a product resource .
23,851
public static final String formatProductSetName ( String project , String location , String productSet ) { return PRODUCT_SET_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location , "product_set" , productSet ) ; }
Formats a string containing the fully - qualified path to represent a product_set resource .
23,852
public static final String formatReferenceImageName ( String project , String location , String product , String referenceImage ) { return REFERENCE_IMAGE_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location , "product" , product , "reference_image" , referenceImage ) ; }
Formats a string containing the fully - qualified path to represent a reference_image resource .
23,853
public final Product createProduct ( String parent , Product product , String productId ) { CreateProductRequest request = CreateProductRequest . newBuilder ( ) . setParent ( parent ) . setProduct ( product ) . setProductId ( productId ) . build ( ) ; return createProduct ( request ) ; }
Creates and returns a new product resource .
23,854
public final Product updateProduct ( Product product , FieldMask updateMask ) { UpdateProductRequest request = UpdateProductRequest . newBuilder ( ) . setProduct ( product ) . setUpdateMask ( updateMask ) . build ( ) ; return updateProduct ( request ) ; }
Makes changes to a Product resource . Only the display_name description and labels fields can be updated right now .
23,855
public final ReferenceImage createReferenceImage ( ProductName parent , ReferenceImage referenceImage , String referenceImageId ) { CreateReferenceImageRequest request = CreateReferenceImageRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setReferenceImage ( referenceImage ) . se...
Creates and returns a new ReferenceImage resource .
23,856
public final ProductSet createProductSet ( LocationName parent , ProductSet productSet , String productSetId ) { CreateProductSetRequest request = CreateProductSetRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setProductSet ( productSet ) . setProductSetId ( productSetId ) . bu...
Creates and returns a new ProductSet resource .
23,857
public final ProductSet updateProductSet ( ProductSet productSet , FieldMask updateMask ) { UpdateProductSetRequest request = UpdateProductSetRequest . newBuilder ( ) . setProductSet ( productSet ) . setUpdateMask ( updateMask ) . build ( ) ; return updateProductSet ( request ) ; }
Makes changes to a ProductSet resource . Only display_name can be updated currently .
23,858
public Table updateTableDescription ( String datasetName , String tableName , String newDescription ) { Table beforeTable = bigquery . getTable ( datasetName , tableName ) ; TableInfo tableInfo = beforeTable . toBuilder ( ) . setDescription ( newDescription ) . build ( ) ; Table afterTable = bigquery . update ( tableIn...
Example of updating a table by changing its description .
23,859
private String canonicalString ( ) { ImmutableList < String > segments = getSegments ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { if ( i > 0 ) { builder . append ( "." ) ; } String escaped = segments . get ( i ) ; escaped = escaped . replace ( "\\" , "\\\\" ...
Encodes a list of field name segments in the server - accepted format .
23,860
public static QuerySnapshot withDocuments ( final Query query , Timestamp readTime , final List < QueryDocumentSnapshot > documents ) { return new QuerySnapshot ( query , readTime ) { volatile List < DocumentChange > documentChanges ; public List < QueryDocumentSnapshot > getDocuments ( ) { return Collections . unmodif...
Creates a new QuerySnapshot representing the results of a Query with added documents .
23,861
public static QuerySnapshot withChanges ( final Query query , Timestamp readTime , final DocumentSet documentSet , final List < DocumentChange > documentChanges ) { return new QuerySnapshot ( query , readTime ) { volatile List < QueryDocumentSnapshot > documents ; public List < QueryDocumentSnapshot > getDocuments ( ) ...
Creates a new QuerySnapshot representing a snapshot of a Query with changed documents .
23,862
public com . google . bigtable . admin . v2 . InstanceName getInstanceName ( ) { return com . google . bigtable . admin . v2 . InstanceName . of ( projectId , instanceId ) ; }
Gets the instanceName this client is associated with .
23,863
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Table > createTableAsync ( CreateTableRequest request ) { return transformToTableResponse ( this . stub . createTableCallable ( ) . futureCall ( request . toProto ( projectId , instanceId ) ) ) ; }
Creates a new table with the specified configuration asynchronously
23,864
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Table > modifyFamiliesAsync ( ModifyColumnFamiliesRequest request ) { return transformToTableResponse ( this . stub . modifyColumnFamiliesCallable ( ) . futureCall ( request . toProto ( projectId , instanceId ) ) ) ; }
Asynchronously creates updates and drops ColumnFamilies as per the request .
23,865
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Void > deleteTableAsync ( String tableId ) { DeleteTableRequest request = DeleteTableRequest . newBuilder ( ) . setName ( getTableName ( tableId ) ) . build ( ) ; return transformToVoid ( this . stub . deleteTableCallable ( ) . futureCall ( request ) ) ; }
Asynchronously deletes the table specified by tableId .
23,866
public ApiFuture < Boolean > existsAsync ( String tableId ) { ApiFuture < Table > protoFuture = getTableAsync ( tableId , com . google . bigtable . admin . v2 . Table . View . NAME_ONLY ) ; ApiFuture < Boolean > existsFuture = ApiFutures . transform ( protoFuture , new ApiFunction < Table , Boolean > ( ) { public Boole...
Asynchronously checks if the table specified by the tableId exists
23,867
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Table > getTableAsync ( String tableId ) { return getTableAsync ( tableId , com . google . bigtable . admin . v2 . Table . View . SCHEMA_VIEW ) ; }
Asynchronously gets the table metadata by tableId .
23,868
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < List < String > > listTablesAsync ( ) { ListTablesRequest request = ListTablesRequest . newBuilder ( ) . setParent ( NameUtil . formatInstanceName ( projectId , instanceId ) ) . build ( ) ; ApiFuture < ListTablesPage > firstPageFuture = ApiFutures . transform ( s...
Asynchronously lists all table ids in the instance .
23,869
@ SuppressWarnings ( "WeakerAccess" ) public void dropRowRange ( String tableId , String rowKeyPrefix ) { ApiExceptions . callAndTranslateApiException ( dropRowRangeAsync ( tableId , rowKeyPrefix ) ) ; }
Drops rows by the specified key prefix and tableId
23,870
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Void > dropAllRowsAsync ( String tableId ) { DropRowRangeRequest request = DropRowRangeRequest . newBuilder ( ) . setName ( getTableName ( tableId ) ) . setDeleteAllDataFromTable ( true ) . build ( ) ; return transformToVoid ( this . stub . dropRowRangeCallable (...
Asynchornously drops all data in the table .
23,871
@ SuppressWarnings ( "WeakerAccess" ) public void awaitReplication ( String tableId ) { com . google . bigtable . admin . v2 . TableName tableName = com . google . bigtable . admin . v2 . TableName . of ( projectId , instanceId , tableId ) ; ApiExceptions . callAndTranslateApiException ( stub . awaitReplicationCallable...
Blocks until replication has caught up to the point this method was called . This allows callers to make sure that their mutations have been replicated across all of their clusters .
23,872
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Void > awaitReplicationAsync ( final String tableId ) { com . google . bigtable . admin . v2 . TableName tableName = com . google . bigtable . admin . v2 . TableName . of ( projectId , instanceId , tableId ) ; return stub . awaitReplicationCallable ( ) . futureCa...
Returns a future that is resolved when replication has caught up to the point this method was called . This allows callers to make sure that their mutations have been replicated across all of their clusters .
23,873
public final Profile updateProfile ( Profile profile ) { UpdateProfileRequest request = UpdateProfileRequest . newBuilder ( ) . setProfile ( profile ) . build ( ) ; return updateProfile ( request ) ; }
Updates the specified profile and returns the updated result .
23,874
public synchronized void start ( ) { if ( isStarted ( ) ) { return ; } MonitoredResource resource = getMonitoredResource ( getProjectId ( ) ) ; defaultWriteOptions = new WriteOption [ ] { WriteOption . logName ( getLogName ( ) ) , WriteOption . resource ( resource ) } ; getLogging ( ) . setFlushSeverity ( severityFor (...
Initialize and configure the cloud logging service .
23,875
private static Severity severityFor ( Level level ) { switch ( level . toInt ( ) ) { case 5000 : return Severity . DEBUG ; case 10000 : return Severity . DEBUG ; case 20000 : return Severity . INFO ; case 30000 : return Severity . WARNING ; case 40000 : return Severity . ERROR ; default : return Severity . DEFAULT ; } ...
Transforms Logback logging levels to Cloud severity .
23,876
@ SuppressWarnings ( "WeakerAccess" ) public UpdateInstanceRequest setProductionType ( ) { builder . getInstanceBuilder ( ) . setType ( Type . PRODUCTION ) ; updateFieldMask ( Instance . TYPE_FIELD_NUMBER ) ; return this ; }
Upgrades the instance from a DEVELOPMENT instance to a PRODUCTION instance . This cannot be undone .
23,877
public final AnnotateTextResponse annotateText ( Document document , AnnotateTextRequest . Features features ) { AnnotateTextRequest request = AnnotateTextRequest . newBuilder ( ) . setDocument ( document ) . setFeatures ( features ) . build ( ) ; return annotateText ( request ) ; }
A convenience method that provides all the features that analyzeSentiment analyzeEntities and analyzeSyntax provide in one call .
23,878
public void downloadTo ( Path path , BlobSourceOption ... options ) { try ( OutputStream outputStream = Files . newOutputStream ( path ) ; ReadChannel reader = reader ( options ) ) { WritableByteChannel channel = Channels . newChannel ( outputStream ) ; ByteBuffer bytes = ByteBuffer . allocate ( DEFAULT_CHUNK_SIZE ) ; ...
Downloads this blob to the given file path using specified blob read options .
23,879
public boolean exists ( BlobSourceOption ... options ) { int length = options . length ; Storage . BlobGetOption [ ] getOptions = Arrays . copyOf ( toGetOptions ( this , options ) , length + 1 ) ; getOptions [ length ] = Storage . BlobGetOption . fields ( ) ; return storage . get ( getBlobId ( ) , getOptions ) != null ...
Checks if this blob exists .
23,880
public ModifyColumnFamiliesRequest addFamily ( String familyId , GCRule gcRule ) { Preconditions . checkNotNull ( gcRule ) ; Modification . Builder modification = Modification . newBuilder ( ) . setId ( familyId ) ; modification . getCreateBuilder ( ) . setGcRule ( gcRule . toProto ( ) ) ; modFamilyRequest . addModific...
Configures the name and GcRule of the new ColumnFamily to be created
23,881
public ModifyColumnFamiliesRequest dropFamily ( String familyId ) { Modification . Builder modification = Modification . newBuilder ( ) . setId ( familyId ) . setDrop ( true ) ; modFamilyRequest . addModifications ( modification . build ( ) ) ; return this ; }
Drops the specified ColumnFamily
23,882
public final Document updateDocument ( Document document , DocumentMask updateMask ) { UpdateDocumentRequest request = UpdateDocumentRequest . newBuilder ( ) . setDocument ( document ) . setUpdateMask ( updateMask ) . build ( ) ; return updateDocument ( request ) ; }
Updates or inserts a document .
23,883
public final BeginTransactionResponse beginTransaction ( String database ) { BeginTransactionRequest request = BeginTransactionRequest . newBuilder ( ) . setDatabase ( database ) . build ( ) ; return beginTransaction ( request ) ; }
Starts a new transaction .
23,884
public final CommitResponse commit ( String database , List < Write > writes ) { CommitRequest request = CommitRequest . newBuilder ( ) . setDatabase ( database ) . addAllWrites ( writes ) . build ( ) ; return commit ( request ) ; }
Commits a transaction while optionally updating documents .
23,885
public final void rollback ( String database , ByteString transaction ) { RollbackRequest request = RollbackRequest . newBuilder ( ) . setDatabase ( database ) . setTransaction ( transaction ) . build ( ) ; rollback ( request ) ; }
Rolls back a transaction .
23,886
public final ListCollectionIdsPagedResponse listCollectionIds ( String parent ) { ListCollectionIdsRequest request = ListCollectionIdsRequest . newBuilder ( ) . setParent ( parent ) . build ( ) ; return listCollectionIds ( request ) ; }
Lists all the collection IDs underneath a document .
23,887
public Policy listBucketIamMembers ( String bucketName ) { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Policy policy = storage . getIamPolicy ( bucketName ) ; Map < Role , Set < Identity > > policyBindings = policy . getBindings ( ) ; for ( Map . Entry < Role , Set < Identity > > entry ...
Example of listing the Bucket - Level IAM Roles and Members
23,888
public Policy addBucketIamMember ( String bucketName , Role role , Identity identity ) { Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Policy policy = storage . getIamPolicy ( bucketName ) ; Policy updatedPolicy = storage . setIamPolicy ( bucketName , policy . toBuilder ( ) . addIdentity ...
Example of adding a member to the Bucket - level IAM
23,889
public static FormatOptions of ( String format ) { if ( checkNotNull ( format ) . equals ( CSV ) ) { return csv ( ) ; } else if ( format . equals ( DATASTORE_BACKUP ) ) { return datastoreBackup ( ) ; } else if ( format . equals ( GOOGLE_SHEETS ) ) { return googleSheets ( ) ; } else if ( format . equals ( BIGTABLE ) ) {...
Default options for the provided format .
23,890
private UnaryCallable < MutateRowsRequest , Void > createMutateRowsBaseCallable ( ) { RetryAlgorithm < Void > retryAlgorithm = new RetryAlgorithm < > ( new ApiResultRetryAlgorithm < Void > ( ) , new ExponentialRetryAlgorithm ( settings . bulkMutateRowsSettings ( ) . getRetrySettings ( ) , clientContext . getClock ( ) )...
Internal helper to create the base MutateRows callable chain . The chain is responsible for retrying individual entry in case of error .
23,891
public static Builder newBuilderForEmulator ( int port ) { Builder builder = newBuilder ( ) . setProjectId ( "fake-project" ) . setInstanceId ( "fake-instance" ) ; builder . stubSettings ( ) . setCredentialsProvider ( NoCredentialsProvider . create ( ) ) . setEndpoint ( "localhost:" + port ) . setTransportChannelProvid...
Create a new builder preconfigured to connect to the Bigtable emulator .
23,892
public final Operation updateRouter ( ProjectRegionRouterName router , Router routerResource , List < String > fieldMask ) { UpdateRouterHttpRequest request = UpdateRouterHttpRequest . newBuilder ( ) . setRouter ( router == null ? null : router . toString ( ) ) . setRouterResource ( routerResource ) . addAllFieldMask (...
Updates the specified Router resource with the data included in the request .
23,893
private SignatureInfo buildSignatureInfo ( Map < SignUrlOption . Option , Object > optionMap , BlobInfo blobInfo , long expiration , URI path , String accountEmail ) { HttpMethod httpVerb = optionMap . containsKey ( SignUrlOption . Option . HTTP_METHOD ) ? ( HttpMethod ) optionMap . get ( SignUrlOption . Option . HTTP_...
Builds signature info .
23,894
private static < T > T get ( final Future < T > future ) throws SpannerException { final Context context = Context . current ( ) ; try { return future . get ( ) ; } catch ( InterruptedException e ) { future . cancel ( true ) ; throw SpannerExceptionFactory . propagateInterrupt ( e ) ; } catch ( ExecutionException | Can...
Gets the result of an async RPC call handling any exceptions encountered .
23,895
public final Operation updateUrlMap ( ProjectGlobalUrlMapName urlMap , UrlMap urlMapResource , List < String > fieldMask ) { UpdateUrlMapHttpRequest request = UpdateUrlMapHttpRequest . newBuilder ( ) . setUrlMap ( urlMap == null ? null : urlMap . toString ( ) ) . setUrlMapResource ( urlMapResource ) . addAllFieldMask (...
Updates the specified UrlMap resource with the data included in the request .
23,896
public final Job updateJob ( Job job ) { UpdateJobRequest request = UpdateJobRequest . newBuilder ( ) . setJob ( job ) . build ( ) ; return updateJob ( request ) ; }
Updates specified job .
23,897
static TranslateTextResponse translateText ( String projectId , String location , String text , String sourceLanguageCode , String targetLanguageCode ) { try ( TranslationServiceClient translationServiceClient = TranslationServiceClient . create ( ) ) { LocationName locationName = LocationName . newBuilder ( ) . setPro...
Translates a given text to a target language .
23,898
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Cluster , UpdateClusterMetadata > updateClusterAsync ( Cluster request ) { return updateClusterOperationCallable ( ) . futureCall ( request ) ; }
Updates a cluster within an instance .
23,899
public final AppProfile createAppProfile ( InstanceName parent , String appProfileId , AppProfile appProfile ) { CreateAppProfileRequest request = CreateAppProfileRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setAppProfileId ( appProfileId ) . setAppProfile ( appProfile ) . bu...
Creates an app profile within an instance .