idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
23,600
CacheBucketOffset get ( UUID keyHash , int generation ) { CacheEntry entry ; synchronized ( this ) { CacheBucketOffset tailOffset = this . tailOffsets . get ( keyHash ) ; if ( tailOffset != null ) { return tailOffset ; } entry = this . cacheEntries . get ( getHashGroup ( keyHash ) ) ; } if ( entry != null ) { Long r = entry . get ( keyHash , generation ) ; if ( r != null ) { return CacheBucketOffset . decode ( r ) ; } } return null ; }
Looks up a cached offset for the given Key Hash .
23,601
public DataFrameRecord < T > getNext ( ) throws DataCorruptionException , DurableDataLogException { Exceptions . checkNotClosed ( this . closed , closed ) ; try { while ( ! this . dataFrameInputStream . isClosed ( ) ) { try { if ( ! this . dataFrameInputStream . beginRecord ( ) ) { return null ; } T logItem = this . serializer . deserialize ( this . dataFrameInputStream ) ; DataFrameRecord . RecordInfo recordInfo = this . dataFrameInputStream . endRecord ( ) ; long seqNo = logItem . getSequenceNumber ( ) ; if ( seqNo <= this . lastReadSequenceNumber ) { throw new DataCorruptionException ( String . format ( "Invalid Operation Sequence Number. Expected: larger than %d, found: %d." , this . lastReadSequenceNumber , seqNo ) ) ; } this . lastReadSequenceNumber = seqNo ; return new DataFrameRecord < > ( logItem , recordInfo ) ; } catch ( DataFrameInputStream . RecordResetException | DataFrameInputStream . NoMoreRecordsException ex ) { } catch ( IOException ex ) { throw new DataCorruptionException ( "Deserialization failed." , ex ) ; } } return null ; } catch ( Exception ex ) { close ( ) ; throw ex ; } }
Attempts to return the next Operation from the DataFrameLog .
23,602
public void emitTypeVariables ( List < TypeVariableName > typeVariables ) throws IOException { if ( typeVariables . isEmpty ( ) ) return ; typeVariables . forEach ( typeVariable -> currentTypeVariables . add ( typeVariable . name ) ) ; emit ( "<" ) ; boolean firstTypeVariable = true ; for ( TypeVariableName typeVariable : typeVariables ) { if ( ! firstTypeVariable ) emit ( ", " ) ; emitAnnotations ( typeVariable . annotations , true ) ; emit ( "$L" , typeVariable . name ) ; boolean firstBound = true ; for ( TypeName bound : typeVariable . bounds ) { emit ( firstBound ? " extends $T" : " & $T" , bound ) ; firstBound = false ; } firstTypeVariable = false ; } emit ( ">" ) ; }
Emit type variables with their bounds . This should only be used when declaring type variables ; everywhere else bounds are omitted .
23,603
Map < String , ClassName > suggestedImports ( ) { Map < String , ClassName > result = new LinkedHashMap < > ( importableTypes ) ; result . keySet ( ) . removeAll ( referencedNames ) ; return result ; }
Returns the types that should have been imported for this code . If there were any simple name collisions that type s first use is imported .
23,604
public String reflectionName ( ) { return enclosingClassName != null ? ( enclosingClassName . reflectionName ( ) + '$' + simpleName ) : ( packageName . isEmpty ( ) ? simpleName : packageName + '.' + simpleName ) ; }
Return the binary name of a class .
23,605
private List < ClassName > enclosingClasses ( ) { List < ClassName > result = new ArrayList < > ( ) ; for ( ClassName c = this ; c != null ; c = c . enclosingClassName ) { result . add ( c ) ; } Collections . reverse ( result ) ; return result ; }
Returns all enclosing classes in this outermost first .
23,606
void wrappingSpace ( int indentLevel ) throws IOException { if ( closed ) throw new IllegalStateException ( "closed" ) ; if ( this . nextFlush != null ) flush ( nextFlush ) ; column ++ ; this . nextFlush = FlushType . SPACE ; this . indentLevel = indentLevel ; }
Emit either a space or a newline character .
23,607
void zeroWidthSpace ( int indentLevel ) throws IOException { if ( closed ) throw new IllegalStateException ( "closed" ) ; if ( column == 0 ) return ; if ( this . nextFlush != null ) flush ( nextFlush ) ; this . nextFlush = FlushType . EMPTY ; this . indentLevel = indentLevel ; }
Emit a newline character if the line will exceed it s limit otherwise do nothing .
23,608
private void flush ( FlushType flushType ) throws IOException { switch ( flushType ) { case WRAP : out . append ( '\n' ) ; for ( int i = 0 ; i < indentLevel ; i ++ ) { out . append ( indent ) ; } column = indentLevel * indent . length ( ) ; column += buffer . length ( ) ; break ; case SPACE : out . append ( ' ' ) ; break ; case EMPTY : break ; default : throw new IllegalArgumentException ( "Unknown FlushType: " + flushType ) ; } out . append ( buffer ) ; buffer . delete ( 0 , buffer . length ( ) ) ; indentLevel = - 1 ; nextFlush = null ; }
Write the space followed by any buffered text that follows it .
23,609
public byte [ ] sign ( byte [ ] headerBytes , byte [ ] payloadBytes ) throws SignatureGenerationException { byte [ ] contentBytes = new byte [ headerBytes . length + 1 + payloadBytes . length ] ; System . arraycopy ( headerBytes , 0 , contentBytes , 0 , headerBytes . length ) ; contentBytes [ headerBytes . length ] = ( byte ) '.' ; System . arraycopy ( payloadBytes , 0 , contentBytes , headerBytes . length + 1 , payloadBytes . length ) ; return sign ( contentBytes ) ; }
Sign the given content using this Algorithm instance .
23,610
static String [ ] splitToken ( String token ) throws JWTDecodeException { String [ ] parts = token . split ( "\\." ) ; if ( parts . length == 2 && token . endsWith ( "." ) ) { parts = new String [ ] { parts [ 0 ] , parts [ 1 ] , "" } ; } if ( parts . length != 3 ) { throw new JWTDecodeException ( String . format ( "The token was expected to have 3 parts, but got %s." , parts . length ) ) ; } return parts ; }
Splits the given token on the . chars into a String array with 3 parts .
23,611
byte [ ] createSignatureFor ( String algorithm , byte [ ] secretBytes , byte [ ] headerBytes , byte [ ] payloadBytes ) throws NoSuchAlgorithmException , InvalidKeyException { final Mac mac = Mac . getInstance ( algorithm ) ; mac . init ( new SecretKeySpec ( secretBytes , algorithm ) ) ; mac . update ( headerBytes ) ; mac . update ( JWT_PART_SEPARATOR ) ; return mac . doFinal ( payloadBytes ) ; }
Create signature for JWT header and payload .
23,612
boolean verifySignatureFor ( String algorithm , PublicKey publicKey , byte [ ] headerBytes , byte [ ] payloadBytes , byte [ ] signatureBytes ) throws NoSuchAlgorithmException , InvalidKeyException , SignatureException { final Signature s = Signature . getInstance ( algorithm ) ; s . initVerify ( publicKey ) ; s . update ( headerBytes ) ; s . update ( JWT_PART_SEPARATOR ) ; s . update ( payloadBytes ) ; return s . verify ( signatureBytes ) ; }
Verify signature for JWT header and payload using a public key .
23,613
byte [ ] createSignatureFor ( String algorithm , PrivateKey privateKey , byte [ ] headerBytes , byte [ ] payloadBytes ) throws NoSuchAlgorithmException , InvalidKeyException , SignatureException { final Signature s = Signature . getInstance ( algorithm ) ; s . initSign ( privateKey ) ; s . update ( headerBytes ) ; s . update ( JWT_PART_SEPARATOR ) ; s . update ( payloadBytes ) ; return s . sign ( ) ; }
Create signature for JWT header and payload using a private key .
23,614
public DecodedJWT verify ( String token ) throws JWTVerificationException { DecodedJWT jwt = new JWTDecoder ( parser , token ) ; return verify ( jwt ) ; }
Perform the verification against the given Token using any previous configured options .
23,615
public DecodedJWT verify ( DecodedJWT jwt ) throws JWTVerificationException { verifyAlgorithm ( jwt , algorithm ) ; algorithm . verify ( jwt ) ; verifyClaims ( jwt , claims ) ; return jwt ; }
Perform the verification against the given decoded JWT using any previous configured options .
23,616
static Claim extractClaim ( String claimName , Map < String , JsonNode > tree , ObjectReader objectReader ) { JsonNode node = tree . get ( claimName ) ; return claimFromNode ( node , objectReader ) ; }
Helper method to extract a Claim from the given JsonNode tree .
23,617
static Claim claimFromNode ( JsonNode node , ObjectReader objectReader ) { if ( node == null || node . isNull ( ) || node . isMissingNode ( ) ) { return new NullClaim ( ) ; } return new JsonNodeClaim ( node , objectReader ) ; }
Helper method to create a Claim representation from the given JsonNode .
23,618
public OperationFuture < Database , CreateDatabaseMetadata > createDatabase ( String databaseId , Iterable < String > statements ) throws SpannerException { return dbClient . createDatabase ( instanceId ( ) , databaseId , statements ) ; }
Creates a new database in this instance .
23,619
static FirestoreException serverRejected ( Status status , String message , Object ... params ) { return new FirestoreException ( String . format ( message , params ) , status ) ; }
Creates a FirestoreException with the provided GRPC Status code and message in a nested exception .
23,620
public static void main ( String [ ] args ) throws IOException { AddressClient client = createCredentialedClient ( ) ; System . out . println ( "Running with Gapic Client." ) ; AddressClient . ListAddressesPagedResponse listResponse = listAddresses ( client ) ; verifyListAddressWithGets ( client , listResponse ) ; System . out . println ( "Running with Gapic Client and Resource Name." ) ; String newAddressName = "new_address_name" ; System . out . println ( "Inserting address:" ) ; insertNewAddressJustClient ( client , newAddressName ) ; listAddresses ( client ) ; System . out . println ( "Deleting address:" ) ; Operation deleteResponse = client . deleteAddress ( ProjectRegionAddressName . of ( newAddressName , PROJECT_NAME , REGION ) ) ; System . out . format ( "Result of delete: %s\n" , deleteResponse . toString ( ) ) ; int sleepTimeInSeconds = 3 ; System . out . format ( "Waiting %d seconds for server to update...\n" , sleepTimeInSeconds ) ; try { TimeUnit . SECONDS . sleep ( sleepTimeInSeconds ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } listAddresses ( client ) ; }
List addresses Insert an address and then delete the address . Use ResourceNames in the request objects .
23,621
private static void insertNewAddressUsingRequest ( AddressClient client , String newAddressName ) throws InterruptedException , ExecutionException { ProjectRegionName region = ProjectRegionName . of ( PROJECT_NAME , REGION ) ; Address address = Address . newBuilder ( ) . build ( ) ; InsertAddressHttpRequest request = InsertAddressHttpRequest . newBuilder ( ) . setRegion ( region . toString ( ) ) . setAddressResource ( address ) . build ( ) ; Operation response = client . insertAddress ( request ) ; System . out . format ( "Result of insert: %s\n" , response . toString ( ) ) ; }
Use an InsertAddressHttpRequest object to make an addresses . insert method call .
23,622
private static void insertAddressUsingCallable ( AddressClient client , String newAddressName ) throws InterruptedException , ExecutionException { ProjectRegionName region = ProjectRegionName . of ( PROJECT_NAME , REGION ) ; Address address = Address . newBuilder ( ) . build ( ) ; InsertAddressHttpRequest request = InsertAddressHttpRequest . newBuilder ( ) . setRegion ( region . toString ( ) ) . setAddressResource ( address ) . build ( ) ; ApiFuture < Operation > future = client . insertAddressCallable ( ) . futureCall ( request ) ; Operation response = future . get ( ) ; System . out . format ( "Result of insert: %s\n" , response . toString ( ) ) ; }
Use an callable object to make an addresses . insert method call .
23,623
private static AddressClient . ListAddressesPagedResponse listAddresses ( AddressClient client ) { System . out . println ( "Listing addresses:" ) ; ProjectRegionName regionName = ProjectRegionName . newBuilder ( ) . setRegion ( REGION ) . setProject ( PROJECT_NAME ) . build ( ) ; ListAddressesHttpRequest listRequest = ListAddressesHttpRequest . newBuilder ( ) . setRegion ( regionName . toString ( ) ) . build ( ) ; AddressClient . ListAddressesPagedResponse response = client . listAddresses ( listRequest ) ; for ( Address address : response . iterateAll ( ) ) { System . out . println ( "\t - " + address . toString ( ) ) ; } return response ; }
List Addresses in the under the project PROJECT_NAME and region REGION .
23,624
public final Operation patchSslPolicy ( ProjectGlobalSslPolicyName sslPolicy , SslPolicy sslPolicyResource , List < String > fieldMask ) { PatchSslPolicyHttpRequest request = PatchSslPolicyHttpRequest . newBuilder ( ) . setSslPolicy ( sslPolicy == null ? null : sslPolicy . toString ( ) ) . setSslPolicyResource ( sslPolicyResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return patchSslPolicy ( request ) ; }
Patches the specified SSL policy with the data included in the request .
23,625
public final SessionEntityType updateSessionEntityType ( SessionEntityType sessionEntityType ) { UpdateSessionEntityTypeRequest request = UpdateSessionEntityTypeRequest . newBuilder ( ) . setSessionEntityType ( sessionEntityType ) . build ( ) ; return updateSessionEntityType ( request ) ; }
Updates the specified session entity type .
23,626
public Row createRowFromProto ( com . google . bigtable . v2 . Row row ) { RowBuilder < Row > builder = createRowBuilder ( ) ; builder . startRow ( row . getKey ( ) ) ; for ( Family family : row . getFamiliesList ( ) ) { for ( Column column : family . getColumnsList ( ) ) { for ( Cell cell : column . getCellsList ( ) ) { builder . startCell ( family . getName ( ) , column . getQualifier ( ) , cell . getTimestampMicros ( ) , cell . getLabelsList ( ) , cell . getValue ( ) . size ( ) ) ; builder . cellValue ( cell . getValue ( ) ) ; builder . finishCell ( ) ; } } } return builder . finishRow ( ) ; }
Helper to convert a proto Row to a model Row .
23,627
public static final String formatGlossaryName ( String project , String location , String glossary ) { return GLOSSARY_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location , "glossary" , glossary ) ; }
Formats a string containing the fully - qualified path to represent a glossary resource .
23,628
public static final String formatLocationName ( String project , String location ) { return LOCATION_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location ) ; }
Formats a string containing the fully - qualified path to represent a location resource .
23,629
public final DetectLanguageResponse detectLanguage ( String parent , String model , String mimeType ) { if ( ! parent . isEmpty ( ) ) { LOCATION_PATH_TEMPLATE . validate ( parent , "detectLanguage" ) ; } DetectLanguageRequest request = DetectLanguageRequest . newBuilder ( ) . setParent ( parent ) . setModel ( model ) . setMimeType ( mimeType ) . build ( ) ; return detectLanguage ( request ) ; }
Detects the language of text within a request .
23,630
public final SupportedLanguages getSupportedLanguages ( String parent , String displayLanguageCode , String model ) { if ( ! parent . isEmpty ( ) ) { LOCATION_PATH_TEMPLATE . validate ( parent , "getSupportedLanguages" ) ; } GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest . newBuilder ( ) . setParent ( parent ) . setDisplayLanguageCode ( displayLanguageCode ) . setModel ( model ) . build ( ) ; return getSupportedLanguages ( request ) ; }
Returns a list of supported languages for translation .
23,631
public final ListGlossariesPagedResponse listGlossaries ( String parent , String filter ) { if ( ! parent . isEmpty ( ) ) { LOCATION_PATH_TEMPLATE . validate ( parent , "listGlossaries" ) ; } ListGlossariesRequest request = ListGlossariesRequest . newBuilder ( ) . setParent ( parent ) . setFilter ( filter ) . build ( ) ; return listGlossaries ( request ) ; }
Lists glossaries in a project . Returns NOT_FOUND if the project doesn t exist .
23,632
public final Glossary getGlossary ( String name ) { GLOSSARY_PATH_TEMPLATE . validate ( name , "getGlossary" ) ; GetGlossaryRequest request = GetGlossaryRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getGlossary ( request ) ; }
Gets a glossary . Returns NOT_FOUND if the glossary doesn t exist .
23,633
public ApiFuture < String > publish ( PubsubMessage message ) { if ( shutdown . get ( ) ) { throw new IllegalStateException ( "Cannot publish on a shut-down publisher." ) ; } final OutstandingPublish outstandingPublish = new OutstandingPublish ( messageTransform . apply ( message ) ) ; List < OutstandingBatch > batchesToSend ; messagesBatchLock . lock ( ) ; try { batchesToSend = messagesBatch . add ( outstandingPublish ) ; setupAlarm ( ) ; } finally { messagesBatchLock . unlock ( ) ; } messagesWaiter . incrementPendingMessages ( 1 ) ; if ( ! batchesToSend . isEmpty ( ) ) { for ( final OutstandingBatch batch : batchesToSend ) { logger . log ( Level . FINER , "Scheduling a batch for immediate sending." ) ; executor . execute ( new Runnable ( ) { public void run ( ) { publishOutstandingBatch ( batch ) ; } } ) ; } } return outstandingPublish . publishResult ; }
Schedules the publishing of a message . The publishing of the message may occur immediately or be delayed based on the publisher batching options .
23,634
public void shutdown ( ) throws Exception { if ( shutdown . getAndSet ( true ) ) { throw new IllegalStateException ( "Cannot shut down a publisher already shut-down." ) ; } if ( currentAlarmFuture != null && activeAlarm . getAndSet ( false ) ) { currentAlarmFuture . cancel ( false ) ; } publishAllOutstanding ( ) ; backgroundResources . shutdown ( ) ; }
Schedules immediate publishing of any outstanding messages and waits until all are processed .
23,635
public Builder addInterceptors ( Interceptor ... interceptors ) { for ( Interceptor interceptor : interceptors ) { this . interceptors . add ( interceptor ) ; } return this ; }
Adds the exception handler interceptors . Call order will be maintained .
23,636
public final Builder abortOn ( Class < ? extends Exception > ... exceptions ) { for ( Class < ? extends Exception > exception : exceptions ) { nonRetriableExceptions . add ( checkNotNull ( exception ) ) ; } return this ; }
Adds the exceptions to abort on .
23,637
public final Policy setIamPolicy ( String resource , Policy policy ) { SetIamPolicyRequest request = SetIamPolicyRequest . newBuilder ( ) . setResource ( resource ) . setPolicy ( policy ) . build ( ) ; return setIamPolicy ( request ) ; }
Sets the access control policy on an instance resource . Replaces any existing policy .
23,638
public final Policy getIamPolicy ( String resource ) { GetIamPolicyRequest request = GetIamPolicyRequest . newBuilder ( ) . setResource ( resource ) . build ( ) ; return getIamPolicy ( request ) ; }
Gets the access control policy for an instance resource . Returns an empty policy if an instance exists but does not have a policy set .
23,639
public final ListJobsPagedResponse listJobs ( LocationName parent ) { ListJobsRequest request = ListJobsRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listJobs ( request ) ; }
Lists jobs .
23,640
public final Job updateJob ( Job job , FieldMask updateMask ) { UpdateJobRequest request = UpdateJobRequest . newBuilder ( ) . setJob ( job ) . setUpdateMask ( updateMask ) . build ( ) ; return updateJob ( request ) ; }
Updates a job .
23,641
public final Context updateContext ( Context context ) { UpdateContextRequest request = UpdateContextRequest . newBuilder ( ) . setContext ( context ) . build ( ) ; return updateContext ( request ) ; }
Updates the specified context .
23,642
public final ListClustersResponse listClusters ( String projectId , String zone ) { ListClustersRequest request = ListClustersRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . build ( ) ; return listClusters ( request ) ; }
Lists all clusters owned by a project in either the specified zone or all zones .
23,643
public final Cluster getCluster ( String projectId , String zone , String clusterId ) { GetClusterRequest request = GetClusterRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . build ( ) ; return getCluster ( request ) ; }
Gets the details of a specific cluster .
23,644
public final Operation createCluster ( String projectId , String zone , Cluster cluster ) { CreateClusterRequest request = CreateClusterRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setCluster ( cluster ) . build ( ) ; return createCluster ( request ) ; }
Creates a cluster consisting of the specified number and type of Google Compute Engine instances .
23,645
public final Operation updateCluster ( String projectId , String zone , String clusterId , ClusterUpdate update ) { UpdateClusterRequest request = UpdateClusterRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setUpdate ( update ) . build ( ) ; return updateCluster ( request ) ; }
Updates the settings of a specific cluster .
23,646
public final Operation setLoggingService ( String projectId , String zone , String clusterId , String loggingService ) { SetLoggingServiceRequest request = SetLoggingServiceRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setLoggingService ( loggingService ) . build ( ) ; return setLoggingService ( request ) ; }
Sets the logging service for a specific cluster .
23,647
public final Operation setMonitoringService ( String projectId , String zone , String clusterId , String monitoringService ) { SetMonitoringServiceRequest request = SetMonitoringServiceRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setMonitoringService ( monitoringService ) . build ( ) ; return setMonitoringService ( request ) ; }
Sets the monitoring service for a specific cluster .
23,648
public final Operation setAddonsConfig ( String projectId , String zone , String clusterId , AddonsConfig addonsConfig ) { SetAddonsConfigRequest request = SetAddonsConfigRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setAddonsConfig ( addonsConfig ) . build ( ) ; return setAddonsConfig ( request ) ; }
Sets the addons for a specific cluster .
23,649
public final Operation setLocations ( String projectId , String zone , String clusterId , List < String > locations ) { SetLocationsRequest request = SetLocationsRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . addAllLocations ( locations ) . build ( ) ; return setLocations ( request ) ; }
Sets the locations for a specific cluster .
23,650
public final Operation updateMaster ( String projectId , String zone , String clusterId , String masterVersion ) { UpdateMasterRequest request = UpdateMasterRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setMasterVersion ( masterVersion ) . build ( ) ; return updateMaster ( request ) ; }
Updates the master for a specific cluster .
23,651
public final Operation deleteCluster ( String projectId , String zone , String clusterId ) { DeleteClusterRequest request = DeleteClusterRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . build ( ) ; return deleteCluster ( request ) ; }
Deletes the cluster including the Kubernetes endpoint and all worker nodes .
23,652
public final ListOperationsResponse listOperations ( String projectId , String zone ) { ListOperationsRequest request = ListOperationsRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . build ( ) ; return listOperations ( request ) ; }
Lists all operations in a project in a specific zone or all zones .
23,653
public final Operation getOperation ( String projectId , String zone , String operationId ) { GetOperationRequest request = GetOperationRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setOperationId ( operationId ) . build ( ) ; return getOperation ( request ) ; }
Gets the specified operation .
23,654
public final void cancelOperation ( String projectId , String zone , String operationId ) { CancelOperationRequest request = CancelOperationRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setOperationId ( operationId ) . build ( ) ; cancelOperation ( request ) ; }
Cancels the specified operation .
23,655
public final ServerConfig getServerConfig ( String projectId , String zone ) { GetServerConfigRequest request = GetServerConfigRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . build ( ) ; return getServerConfig ( request ) ; }
Returns configuration info about the Kubernetes Engine service .
23,656
public final ListNodePoolsResponse listNodePools ( String projectId , String zone , String clusterId ) { ListNodePoolsRequest request = ListNodePoolsRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . build ( ) ; return listNodePools ( request ) ; }
Lists the node pools for a cluster .
23,657
public final NodePool getNodePool ( String projectId , String zone , String clusterId , String nodePoolId ) { GetNodePoolRequest request = GetNodePoolRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setNodePoolId ( nodePoolId ) . build ( ) ; return getNodePool ( request ) ; }
Retrieves the node pool requested .
23,658
public final Operation createNodePool ( String projectId , String zone , String clusterId , NodePool nodePool ) { CreateNodePoolRequest request = CreateNodePoolRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setNodePool ( nodePool ) . build ( ) ; return createNodePool ( request ) ; }
Creates a node pool for a cluster .
23,659
public final Operation deleteNodePool ( String projectId , String zone , String clusterId , String nodePoolId ) { DeleteNodePoolRequest request = DeleteNodePoolRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setNodePoolId ( nodePoolId ) . build ( ) ; return deleteNodePool ( request ) ; }
Deletes a node pool from a cluster .
23,660
public final Operation rollbackNodePoolUpgrade ( String projectId , String zone , String clusterId , String nodePoolId ) { RollbackNodePoolUpgradeRequest request = RollbackNodePoolUpgradeRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setNodePoolId ( nodePoolId ) . build ( ) ; return rollbackNodePoolUpgrade ( request ) ; }
Roll back the previously Aborted or Failed NodePool upgrade . This will be an no - op if the last upgrade successfully completed .
23,661
public final Operation setLegacyAbac ( String projectId , String zone , String clusterId , boolean enabled ) { SetLegacyAbacRequest request = SetLegacyAbacRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setEnabled ( enabled ) . build ( ) ; return setLegacyAbac ( request ) ; }
Enables or disables the ABAC authorization mechanism on a cluster .
23,662
public final Operation startIPRotation ( String projectId , String zone , String clusterId ) { StartIPRotationRequest request = StartIPRotationRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . build ( ) ; return startIPRotation ( request ) ; }
Start master IP rotation .
23,663
public final Operation completeIPRotation ( String projectId , String zone , String clusterId ) { CompleteIPRotationRequest request = CompleteIPRotationRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . build ( ) ; return completeIPRotation ( request ) ; }
Completes master IP rotation .
23,664
public final Operation setMaintenancePolicy ( String projectId , String zone , String clusterId , MaintenancePolicy maintenancePolicy ) { SetMaintenancePolicyRequest request = SetMaintenancePolicyRequest . newBuilder ( ) . setProjectId ( projectId ) . setZone ( zone ) . setClusterId ( clusterId ) . setMaintenancePolicy ( maintenancePolicy ) . build ( ) ; return setMaintenancePolicy ( request ) ; }
Sets the maintenance policy for a cluster .
23,665
public final void patchTraces ( String projectId , Traces traces ) { PatchTracesRequest request = PatchTracesRequest . newBuilder ( ) . setProjectId ( projectId ) . setTraces ( traces ) . build ( ) ; patchTraces ( request ) ; }
Sends new traces to Stackdriver Trace or updates existing traces . If the ID of a trace that you send matches that of an existing trace any fields in the existing trace and its spans are overwritten by the provided values and any new fields provided are merged with the existing trace data . If the ID does not match a new trace is created .
23,666
public final Trace getTrace ( String projectId , String traceId ) { GetTraceRequest request = GetTraceRequest . newBuilder ( ) . setProjectId ( projectId ) . setTraceId ( traceId ) . build ( ) ; return getTrace ( request ) ; }
Gets a single trace by its ID .
23,667
public final ListTracesPagedResponse listTraces ( String projectId ) { ListTracesRequest request = ListTracesRequest . newBuilder ( ) . setProjectId ( projectId ) . build ( ) ; return listTraces ( request ) ; }
Returns of a list of traces that match the specified filter conditions .
23,668
public Map < String , Object > getData ( ) { if ( fields == null ) { return null ; } Map < String , Object > decodedFields = new HashMap < > ( ) ; for ( Map . Entry < String , Value > entry : fields . entrySet ( ) ) { Object decodedValue = decodeValue ( entry . getValue ( ) ) ; decodedValue = convertToDateIfNecessary ( decodedValue ) ; decodedFields . put ( entry . getKey ( ) , decodedValue ) ; } return decodedFields ; }
Returns the fields of the document as a Map or null if the document doesn t exist . Field values will be converted to their native Java representation .
23,669
public final ScanConfig updateScanConfig ( ScanConfig scanConfig , FieldMask updateMask ) { UpdateScanConfigRequest request = UpdateScanConfigRequest . newBuilder ( ) . setScanConfig ( scanConfig ) . setUpdateMask ( updateMask ) . build ( ) ; return updateScanConfig ( request ) ; }
Updates a ScanConfig . This method support partial update of a ScanConfig .
23,670
@ SuppressWarnings ( "WeakerAccess" ) public String getId ( ) { InstanceName fullName = Verify . verifyNotNull ( InstanceName . parse ( proto . getName ( ) ) , "Name can never be null" ) ; return fullName . getInstance ( ) ; }
Gets the instance s id .
23,671
protected void error ( E error ) { this . error = checkNotNull ( error ) ; this . completed = true ; for ( Callback < T , E > callback : toBeNotified ) { callback . error ( error ) ; } }
Sets an error and status as completed . Notifies all callbacks .
23,672
protected void success ( T result ) { this . result = result ; this . completed = true ; for ( Callback < T , E > callback : toBeNotified ) { callback . success ( result ) ; } }
Sets a result and status as completed . Notifies all callbacks .
23,673
public final Dataset updateDataset ( Dataset dataset ) { UpdateDatasetRequest request = UpdateDatasetRequest . newBuilder ( ) . setDataset ( dataset ) . build ( ) ; return updateDataset ( request ) ; }
Updates a dataset .
23,674
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Empty , OperationMetadata > exportModelAsync ( ExportModelRequest request ) { return exportModelOperationCallable ( ) . futureCall ( request ) ; }
Exports a trained export - able model to a user specified Google Cloud Storage location . A model is considered export - able if and only if it has an export format defined for it in
23,675
public final TableSpec updateTableSpec ( TableSpec tableSpec ) { UpdateTableSpecRequest request = UpdateTableSpecRequest . newBuilder ( ) . setTableSpec ( tableSpec ) . build ( ) ; return updateTableSpec ( request ) ; }
Updates a table spec .
23,676
public final ColumnSpec updateColumnSpec ( ColumnSpec columnSpec ) { UpdateColumnSpecRequest request = UpdateColumnSpecRequest . newBuilder ( ) . setColumnSpec ( columnSpec ) . build ( ) ; return updateColumnSpec ( request ) ; }
Updates a column spec .
23,677
public final Intent createIntent ( ProjectAgentName parent , Intent intent ) { CreateIntentRequest request = CreateIntentRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setIntent ( intent ) . build ( ) ; return createIntent ( request ) ; }
Creates an intent in the specified agent .
23,678
public UnixPath subpath ( int beginIndex , int endIndex ) { if ( path . isEmpty ( ) && beginIndex == 0 && endIndex == 1 ) { return this ; } checkArgument ( beginIndex >= 0 && endIndex > beginIndex ) ; List < String > subList ; try { subList = getParts ( ) . subList ( beginIndex , endIndex ) ; } catch ( IndexOutOfBoundsException e ) { throw new IllegalArgumentException ( ) ; } return new UnixPath ( permitEmptyComponents , JOINER . join ( subList ) ) ; }
Returns specified range of sub - components in path joined together .
23,679
public UnixPath toAbsolutePath ( UnixPath currentWorkingDirectory ) { checkArgument ( currentWorkingDirectory . isAbsolute ( ) ) ; return isAbsolute ( ) ? this : currentWorkingDirectory . resolve ( this ) ; }
Converts relative path to an absolute path .
23,680
public UnixPath removeTrailingSeparator ( ) { if ( ! isRoot ( ) && hasTrailingSeparator ( ) ) { return new UnixPath ( permitEmptyComponents , path . substring ( 0 , path . length ( ) - 1 ) ) ; } else { return this ; } }
Removes trailing separator from path unless it s root .
23,681
private List < String > getParts ( ) { List < String > result = lazyStringParts ; return result != null ? result : ( lazyStringParts = path . isEmpty ( ) || isRoot ( ) ? Collections . < String > emptyList ( ) : createParts ( ) ) ; }
Returns list of path components excluding slashes .
23,682
@ SuppressWarnings ( "unchecked" ) public ServiceT getService ( ) { if ( service == null ) { service = serviceFactory . create ( ( OptionsT ) this ) ; } return service ; }
Returns a Service object for the current service . For instance when using Google Cloud Storage it returns a Storage object .
23,683
@ SuppressWarnings ( "unchecked" ) public ServiceRpc getRpc ( ) { if ( rpc == null ) { rpc = serviceRpcFactory . create ( ( OptionsT ) this ) ; } return rpc ; }
Returns a Service RPC object for the current service . For instance when using Google Cloud Storage it returns a StorageRpc object .
23,684
public Credentials getScopedCredentials ( ) { Credentials credentialsToReturn = credentials ; if ( credentials instanceof GoogleCredentials && ( ( GoogleCredentials ) credentials ) . createScopedRequired ( ) ) { credentialsToReturn = ( ( GoogleCredentials ) credentials ) . createScoped ( getScopes ( ) ) ; } return credentialsToReturn ; }
Returns the authentication credentials . If required credentials are scoped .
23,685
@ SuppressWarnings ( "WeakerAccess" ) public String getId ( ) { AppProfileName fullName = Verify . verifyNotNull ( AppProfileName . parse ( proto . getName ( ) ) , "Name can never be null" ) ; return fullName . getAppProfile ( ) ; }
Gets the id of this AppProfile .
23,686
@ SuppressWarnings ( "WeakerAccess" ) public String getInstanceId ( ) { AppProfileName fullName = Verify . verifyNotNull ( AppProfileName . parse ( proto . getName ( ) ) , "Name can never be null" ) ; return fullName . getInstance ( ) ; }
Gets the id of the instance that owns this AppProfile .
23,687
public final Operation patchInterconnect ( ProjectGlobalInterconnectName interconnect , Interconnect interconnectResource , List < String > fieldMask ) { PatchInterconnectHttpRequest request = PatchInterconnectHttpRequest . newBuilder ( ) . setInterconnect ( interconnect == null ? null : interconnect . toString ( ) ) . setInterconnectResource ( interconnectResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return patchInterconnect ( request ) ; }
Updates the specified interconnect with the data included in the request . This method supports PATCH semantics and uses the JSON merge patch format and processing rules .
23,688
public static TransactionOptions create ( int numberOfAttempts ) { Preconditions . checkArgument ( numberOfAttempts > 0 , "You must allow at least one attempt" ) ; return new TransactionOptions ( numberOfAttempts , null , null ) ; }
Create a default set of options with a custom number of retry attempts .
23,689
public static Builder newBuilder ( TableId destinationTable , FormatOptions format ) { return newBuilder ( destinationTable ) . setFormatOptions ( format ) ; }
Creates a builder for a BigQuery Load Configuration given the destination table and format .
23,690
public static WriteChannelConfiguration of ( TableId destinationTable , FormatOptions format ) { return newBuilder ( destinationTable ) . setFormatOptions ( format ) . build ( ) ; }
Returns a BigQuery Load Configuration for the given destination table and format .
23,691
public Subscription createSubscription ( String topicId , String subscriptionId ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; Subscription subscription = subscriptionAdminClient . createSubscription ( subscriptionName , topicName , PushConfig . getDefaultInstance ( ) , 0 ) ; return subscription ; } }
Example of creating a pull subscription for a topic .
23,692
public Subscription createSubscriptionWithPushEndpoint ( String topicId , String subscriptionId , String endpoint ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; PushConfig pushConfig = PushConfig . newBuilder ( ) . setPushEndpoint ( endpoint ) . build ( ) ; int ackDeadlineInSeconds = 10 ; Subscription subscription = subscriptionAdminClient . createSubscription ( subscriptionName , topicName , pushConfig , ackDeadlineInSeconds ) ; return subscription ; } }
Example of creating a subscription with a push endpoint .
23,693
public void replacePushConfig ( String subscriptionId , String endpoint ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; PushConfig pushConfig = PushConfig . newBuilder ( ) . setPushEndpoint ( endpoint ) . build ( ) ; subscriptionAdminClient . modifyPushConfig ( subscriptionName , pushConfig ) ; } }
Example of replacing the push configuration of a subscription setting the push endpoint .
23,694
public ListSubscriptionsPagedResponse listSubscriptions ( ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ListSubscriptionsRequest listSubscriptionsRequest = ListSubscriptionsRequest . newBuilder ( ) . setProject ( ProjectName . of ( projectId ) . toString ( ) ) . build ( ) ; ListSubscriptionsPagedResponse response = subscriptionAdminClient . listSubscriptions ( listSubscriptionsRequest ) ; Iterable < Subscription > subscriptions = response . iterateAll ( ) ; for ( Subscription subscription : subscriptions ) { } return response ; } }
Example of listing subscriptions .
23,695
public ProjectSubscriptionName deleteSubscription ( String subscriptionId ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; subscriptionAdminClient . deleteSubscription ( subscriptionName ) ; return subscriptionName ; } }
Example of deleting a subscription .
23,696
public Policy getSubscriptionPolicy ( String subscriptionId ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; Policy policy = subscriptionAdminClient . getIamPolicy ( subscriptionName . toString ( ) ) ; if ( policy == null ) { } return policy ; } }
Example of getting a subscription policy .
23,697
public Policy replaceSubscriptionPolicy ( String subscriptionId ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; Policy policy = subscriptionAdminClient . getIamPolicy ( subscriptionName . toString ( ) ) ; Binding binding = Binding . newBuilder ( ) . setRole ( Role . viewer ( ) . toString ( ) ) . addMembers ( Identity . allAuthenticatedUsers ( ) . toString ( ) ) . build ( ) ; Policy updatedPolicy = policy . toBuilder ( ) . addBindings ( binding ) . build ( ) ; updatedPolicy = subscriptionAdminClient . setIamPolicy ( subscriptionName . toString ( ) , updatedPolicy ) ; return updatedPolicy ; } }
Example of replacing a subscription policy .
23,698
public Subscription getSubscription ( String subscriptionId ) throws Exception { try ( SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient . create ( ) ) { ProjectSubscriptionName subscriptionName = ProjectSubscriptionName . of ( projectId , subscriptionId ) ; Subscription subscription = subscriptionAdminClient . getSubscription ( subscriptionName ) ; return subscription ; } }
Example of getting a subscription .
23,699
public final Operation patchHttpHealthCheck ( ProjectGlobalHttpHealthCheckName httpHealthCheck , HttpHealthCheck2 httpHealthCheckResource , List < String > fieldMask ) { PatchHttpHealthCheckHttpRequest request = PatchHttpHealthCheckHttpRequest . newBuilder ( ) . setHttpHealthCheck ( httpHealthCheck == null ? null : httpHealthCheck . toString ( ) ) . setHttpHealthCheckResource ( httpHealthCheckResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return patchHttpHealthCheck ( request ) ; }
Updates a HttpHealthCheck resource in the specified project using the data included in the request . This method supports PATCH semantics and uses the JSON merge patch format and processing rules .