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 . setShowMissing ( true ) ; final ListDocumentsPagedResponse response ; try { response = ApiExceptions . callAndTranslateApiException ( firestore . sendRequest ( request . build ( ) , firestore . getClient ( ) . listDocumentsPagedCallable ( ) ) ) ; } catch ( ApiException exception ) { throw FirestoreException . apiException ( exception ) ; } return new Iterable < DocumentReference > ( ) { public Iterator < DocumentReference > iterator ( ) { final Iterator < Document > iterator = response . iterateAll ( ) . iterator ( ) ; return new Iterator < DocumentReference > ( ) { public boolean hasNext ( ) { return iterator . hasNext ( ) ; } public DocumentReference next ( ) { ResourcePath path = ResourcePath . create ( iterator . next ( ) . getName ( ) ) ; return document ( path . getId ( ) ) ; } public void remove ( ) { throw new UnsupportedOperationException ( "remove" ) ; } } ; } } ; } | 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 , DocumentReference > ( ) { public DocumentReference apply ( WriteResult writeResult ) { return documentReference ; } } ) ; } | 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 > ) converted ) ; } | 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 . out . println ( "Requester pay status for " + bucketName + ": " + bucket . requesterPays ( ) ) ; return bucket ; } | 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 ( "Requester pays status for " + bucketName + ": " + bucket . requesterPays ( ) ) ; return bucket ; } | 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 : " + bucket . requesterPays ( ) ) ; return bucket ; } | 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 ( destFilePath , Blob . BlobSourceOption . userProject ( projectId ) ) ; } | 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 . update ( bucketInfo ) ; System . out . println ( "Default KMS Key Name: " + bucket . getDefaultKmsKeyName ( ) ) ; return bucket ; } | 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 ) . build ( ) ) ; System . out . println ( "Retention period for " + bucketName + " is now " + bucketWithRetentionPolicy . getRetentionPeriod ( ) ) ; return bucketWithRetentionPolicy ; } | 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 . retentionPolicyIsLocked ( ) != null && bucket . retentionPolicyIsLocked ( ) ) { throw new IllegalArgumentException ( "Unable to remove retention period as retention policy is locked." ) ; } Bucket bucketWithoutRetentionPolicy = bucket . toBuilder ( ) . setRetentionPeriod ( null ) . build ( ) . update ( ) ; System . out . println ( "Retention period for " + bucketName + " has been removed" ) ; return bucketWithoutRetentionPolicy ; } | 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 " + bucketName ) ; System . out . println ( "Retention Period: " + bucket . getRetentionPeriod ( ) ) ; if ( bucket . retentionPolicyIsLocked ( ) != null && bucket . retentionPolicyIsLocked ( ) ) { System . out . println ( "Retention Policy is locked" ) ; } if ( bucket . getRetentionEffectiveTime ( ) != null ) { System . out . println ( "Effective Time: " + new Date ( bucket . getRetentionEffectiveTime ( ) ) ) ; } return bucket ; } | 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 . lockRetentionPolicy ( Storage . BucketTargetOption . metagenerationMatch ( ) ) ; System . out . println ( "Retention period for " + bucketName + " is now locked" ) ; System . out . println ( "Retention policy effective as of " + new Date ( lockedBucket . getRetentionEffectiveTime ( ) ) ) ; return lockedBucket ; } | 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 ( "Default event-based hold was enabled for " + bucketName ) ; return bucket ; } | 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 ( ) != null && bucket . getDefaultEventBasedHold ( ) ) { System . out . println ( "Default event-based hold is enabled for " + bucketName ) ; } else { System . out . println ( "Default event-based hold is not enabled for " + bucketName ) ; } return bucket ; } | 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 ) . build ( ) ) ; System . out . println ( "Temporary hold was set for " + blobName ) ; return blob ; } | 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 bucket = storage . update ( BucketInfo . newBuilder ( bucketName ) . setIamConfiguration ( iamConfiguration ) . build ( ) ) ; System . out . println ( "Bucket Policy Only was enabled for " + bucketName ) ; return bucket ; } | 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 = bucket . getIamConfiguration ( ) ; Boolean enabled = iamConfiguration . isBucketPolicyOnlyEnabled ( ) ; Date lockedTime = new Date ( iamConfiguration . getBucketPolicyOnlyLockedTime ( ) ) ; if ( enabled != null && enabled ) { System . out . println ( "Bucket Policy Only is enabled for " + bucketName ) ; System . out . println ( "Bucket will be locked on " + lockedTime ) ; } else { System . out . println ( "Bucket Policy Only is disabled for " + bucketName ) ; } return bucket ; } | 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 ( blobinfo , 15 , TimeUnit . MINUTES , Storage . SignUrlOption . withV4Signature ( ) ) ; System . out . println ( "Generated GET signed URL:" ) ; System . out . println ( url ) ; System . out . println ( "You can use this URL with any user agent, for example:" ) ; System . out . println ( "curl '" + url + "'" ) ; return url ; } | 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 > extensionHeaders = new HashMap < > ( ) ; extensionHeaders . put ( "Content-Type" , "application/octet-stream" ) ; URL url = storage . signUrl ( blobinfo , 15 , TimeUnit . MINUTES , Storage . SignUrlOption . httpMethod ( HttpMethod . PUT ) , Storage . SignUrlOption . withExtHeaders ( extensionHeaders ) , Storage . SignUrlOption . withV4Signature ( ) ) ; System . out . println ( "Generated PUT signed URL:" ) ; System . out . println ( url ) ; System . out . println ( "You can use this URL with any user agent, for example:" ) ; System . out . println ( "curl -X PUT -H 'Content-Type: application/octet-stream'--upload-file my-file '" + url + "'" ) ; return url ; } | 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 ( "Table %s created successfully%n" , tableId ) ; } } | 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 ) . setCell ( COLUMN_FAMILY , COLUMN_QUALIFIER , greetings [ i ] ) ; dataClient . mutateRow ( rowMutation ) ; System . out . println ( greetings [ i ] ) ; } } catch ( NotFoundException e ) { System . err . println ( "Failed to write to non-existent table: " + e . getMessage ( ) ) ; } } | 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: %s Qualifier: %s Value: %s%n" , cell . getFamily ( ) , cell . getQualifier ( ) . toStringUtf8 ( ) , cell . getValue ( ) . toStringUtf8 ( ) ) ; } } catch ( NotFoundException e ) { System . err . println ( "Failed to read from a non-existent table: " + e . getMessage ( ) ) ; } } | 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 cell : r . getCells ( ) ) { System . out . printf ( "Family: %s Qualifier: %s Value: %s%n" , cell . getFamily ( ) , cell . getQualifier ( ) . toStringUtf8 ( ) , cell . getValue ( ) . toStringUtf8 ( ) ) ; } } } catch ( NotFoundException e ) { System . err . println ( "Failed to read a non-existent table: " + e . getMessage ( ) ) ; } } | 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 . entrySet ( ) ) { if ( ! Objects . equals ( option . getKey ( ) , pageTokenOption ) ) { builder . put ( option . getKey ( ) , option . getValue ( ) ) ; } } return builder . build ( ) ; } | 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 importSshPublicKey ( request ) ; } | 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 ) ; } sleepForAttempt ( retries ) ; } | 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 ) ; } sleepForAttempt ( reopens ) ; } | 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 ( ) , parent . getName ( ) ) ; } else { keyBuilder = Key . newBuilder ( getProjectId ( ) , parent . getKind ( ) , parent . getId ( ) ) ; } String namespace = getNamespace ( ) ; if ( namespace != null ) { keyBuilder . setNamespace ( namespace ) ; } return keyBuilder . addAncestors ( ancestors . subList ( 0 , ancestors . size ( ) - 1 ) ) . build ( ) ; } | 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 valueArray ; } | 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 ) . setReferenceImageId ( referenceImageId ) . build ( ) ; return createReferenceImage ( request ) ; } | 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 ) . build ( ) ; return createProductSet ( request ) ; } | 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 ( tableInfo ) ; return afterTable ; } | 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 ( "\\" , "\\\\" ) . replace ( "`" , "\\`" ) ; if ( ! isValidIdentifier ( escaped ) ) { escaped = '`' + escaped + '`' ; } builder . append ( escaped ) ; } return builder . toString ( ) ; } | 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 . unmodifiableList ( documents ) ; } public List < DocumentChange > getDocumentChanges ( ) { if ( documentChanges == null ) { synchronized ( documents ) { if ( documentChanges == null ) { documentChanges = new ArrayList < > ( ) ; for ( int i = 0 ; i < documents . size ( ) ; ++ i ) { documentChanges . add ( new DocumentChange ( documents . get ( i ) , Type . ADDED , - 1 , i ) ) ; } } } } return Collections . unmodifiableList ( documentChanges ) ; } public int size ( ) { return documents . size ( ) ; } public boolean equals ( Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } QuerySnapshot that = ( QuerySnapshot ) o ; return Objects . equals ( query , that . query ) && Objects . equals ( this . size ( ) , that . size ( ) ) && Objects . equals ( this . getDocuments ( ) , that . getDocuments ( ) ) ; } public int hashCode ( ) { return Objects . hash ( query , this . getDocuments ( ) ) ; } } ; } | 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 ( ) { if ( documents == null ) { synchronized ( documentSet ) { if ( documents == null ) { documents = documentSet . toList ( ) ; } } } return Collections . unmodifiableList ( documents ) ; } public List < DocumentChange > getDocumentChanges ( ) { return Collections . unmodifiableList ( documentChanges ) ; } public int size ( ) { return documentSet . size ( ) ; } public boolean equals ( Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } QuerySnapshot that = ( QuerySnapshot ) o ; return Objects . equals ( query , that . query ) && Objects . equals ( this . size ( ) , that . size ( ) ) && Objects . equals ( this . getDocumentChanges ( ) , that . getDocumentChanges ( ) ) && Objects . equals ( this . getDocuments ( ) , that . getDocuments ( ) ) ; } public int hashCode ( ) { return Objects . hash ( query , this . getDocumentChanges ( ) , this . 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 Boolean apply ( Table ignored ) { return true ; } } , MoreExecutors . directExecutor ( ) ) ; return ApiFutures . catching ( existsFuture , NotFoundException . class , new ApiFunction < NotFoundException , Boolean > ( ) { public Boolean apply ( NotFoundException ignored ) { return false ; } } , MoreExecutors . directExecutor ( ) ) ; } | 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 ( stub . listTablesPagedCallable ( ) . futureCall ( request ) , new ApiFunction < ListTablesPagedResponse , ListTablesPage > ( ) { public ListTablesPage apply ( ListTablesPagedResponse response ) { return response . getPage ( ) ; } } , MoreExecutors . directExecutor ( ) ) ; ApiFuture < List < com . google . bigtable . admin . v2 . Table > > allProtos = ApiFutures . transformAsync ( firstPageFuture , new ApiAsyncFunction < ListTablesPage , List < com . google . bigtable . admin . v2 . Table > > ( ) { List < com . google . bigtable . admin . v2 . Table > responseAccumulator = Lists . newArrayList ( ) ; public ApiFuture < List < com . google . bigtable . admin . v2 . Table > > apply ( ListTablesPage page ) { responseAccumulator . addAll ( Lists . newArrayList ( page . getValues ( ) ) ) ; if ( ! page . hasNextPage ( ) ) { return ApiFutures . immediateFuture ( responseAccumulator ) ; } return ApiFutures . transformAsync ( page . getNextPageAsync ( ) , this , MoreExecutors . directExecutor ( ) ) ; } } , MoreExecutors . directExecutor ( ) ) ; return ApiFutures . transform ( allProtos , new ApiFunction < List < com . google . bigtable . admin . v2 . Table > , List < String > > ( ) { public List < String > apply ( List < com . google . bigtable . admin . v2 . Table > protos ) { List < String > results = Lists . newArrayListWithCapacity ( protos . size ( ) ) ; for ( com . google . bigtable . admin . v2 . Table proto : protos ) { results . add ( NameUtil . extractTableIdFromTableName ( proto . getName ( ) ) ) ; } return results ; } } , MoreExecutors . directExecutor ( ) ) ; } | 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 ( ) . futureCall ( request ) ) ; } | 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 ( ) . futureCall ( tableName ) ) ; } | 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 ( ) . futureCall ( tableName ) ; } | 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 ( getFlushLevel ( ) ) ) ; loggingEnhancers = new ArrayList < > ( ) ; List < LoggingEnhancer > resourceEnhancers = MonitoredResourceUtil . getResourceEnhancers ( ) ; loggingEnhancers . addAll ( resourceEnhancers ) ; loggingEnhancers . addAll ( getLoggingEnhancers ( ) ) ; loggingEventEnhancers = new ArrayList < > ( ) ; loggingEventEnhancers . addAll ( getLoggingEventEnhancers ( ) ) ; super . start ( ) ; } | 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 ) ; while ( reader . read ( bytes ) > 0 ) { bytes . flip ( ) ; channel . write ( bytes ) ; bytes . clear ( ) ; } } catch ( IOException e ) { throw new StorageException ( e ) ; } } | 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 . addModifications ( modification . build ( ) ) ; return this ; } | 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 : policyBindings . entrySet ( ) ) { System . out . printf ( "Role: %s Identities: %s\n" , entry . getKey ( ) , entry . getValue ( ) ) ; } return policy ; } | 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 ( role , identity ) . build ( ) ) ; if ( updatedPolicy . getBindings ( ) . get ( role ) . contains ( identity ) ) { System . out . printf ( "Added %s with role %s to %s\n" , identity , role , bucketName ) ; } return updatedPolicy ; } | 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 ) ) { return bigtable ( ) ; } return new FormatOptions ( format ) ; } | 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 ( ) ) ) ; RetryingExecutorWithContext < Void > retryingExecutor = new ScheduledRetryingExecutor < > ( retryAlgorithm , clientContext . getExecutor ( ) ) ; return new MutateRowsRetryingCallable ( clientContext . getDefaultCallContext ( ) , stub . mutateRowsCallable ( ) , retryingExecutor , settings . bulkMutateRowsSettings ( ) . getRetryableCodes ( ) ) ; } | 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 ) . setTransportChannelProvider ( InstantiatingGrpcChannelProvider . newBuilder ( ) . setPoolSize ( 1 ) . setChannelConfigurator ( new ApiFunction < ManagedChannelBuilder , ManagedChannelBuilder > ( ) { public ManagedChannelBuilder apply ( ManagedChannelBuilder input ) { return input . usePlaintext ( ) ; } } ) . build ( ) ) ; return builder ; } | 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 ( fieldMask ) . build ( ) ; return updateRouter ( request ) ; } | 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_METHOD ) : HttpMethod . GET ; SignatureInfo . Builder signatureInfoBuilder = new SignatureInfo . Builder ( httpVerb , expiration , path ) ; if ( firstNonNull ( ( Boolean ) optionMap . get ( SignUrlOption . Option . MD5 ) , false ) ) { checkArgument ( blobInfo . getMd5 ( ) != null , "Blob is missing a value for md5" ) ; signatureInfoBuilder . setContentMd5 ( blobInfo . getMd5 ( ) ) ; } if ( firstNonNull ( ( Boolean ) optionMap . get ( SignUrlOption . Option . CONTENT_TYPE ) , false ) ) { checkArgument ( blobInfo . getContentType ( ) != null , "Blob is missing a value for content-type" ) ; signatureInfoBuilder . setContentType ( blobInfo . getContentType ( ) ) ; } signatureInfoBuilder . setSignatureVersion ( ( SignUrlOption . SignatureVersion ) optionMap . get ( SignUrlOption . Option . SIGNATURE_VERSION ) ) ; signatureInfoBuilder . setAccountEmail ( accountEmail ) ; signatureInfoBuilder . setTimestamp ( getOptions ( ) . getClock ( ) . millisTime ( ) ) ; @ SuppressWarnings ( "unchecked" ) Map < String , String > extHeaders = ( Map < String , String > ) ( optionMap . containsKey ( SignUrlOption . Option . EXT_HEADERS ) ? ( Map < String , String > ) optionMap . get ( SignUrlOption . Option . EXT_HEADERS ) : Collections . emptyMap ( ) ) ; return signatureInfoBuilder . setCanonicalizedExtensionHeaders ( extHeaders ) . build ( ) ; } | 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 | CancellationException e ) { throw newSpannerException ( context , e ) ; } } | 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 ( fieldMask ) . build ( ) ; return updateUrlMap ( request ) ; } | 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 ( ) . setProject ( projectId ) . setLocation ( location ) . build ( ) ; TranslateTextRequest translateTextRequest = TranslateTextRequest . newBuilder ( ) . setParent ( locationName . toString ( ) ) . setMimeType ( "text/plain" ) . setSourceLanguageCode ( sourceLanguageCode ) . setTargetLanguageCode ( targetLanguageCode ) . addContents ( text ) . build ( ) ; TranslateTextResponse response = translationServiceClient . translateText ( translateTextRequest ) ; System . out . format ( "Translated Text: %s" , response . getTranslationsList ( ) . get ( 0 ) . getTranslatedText ( ) ) ; return response ; } catch ( Exception e ) { throw new RuntimeException ( "Couldn't create client." , e ) ; } } | 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 ) . build ( ) ; return createAppProfile ( request ) ; } | Creates an app profile within an instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.