public Instance getInstance ( ) { System . out . println ( "\nGet Instance" ) ; // [START bigtable_get_instance] Instance instance = null ; try { instance = adminClient . getInstance ( instanceId ) ; System . out . println ( "Instance ID: " + instance . getId ( ) ) ; System . out . println ( "Display Name: " + instance . getDisplayName ( ) ) ; System . out . print ( "Labels: " ) ; Map < String , String > labels = instance . getLabels ( ) ; for ( String key : labels . keySet ( ) ) { System . out . printf ( "%s - %s" , key , labels . get ( key ) ) ; } System . out . println ( "\nState: " + instance . getState ( ) ) ; System . out . println ( "Type: " + instance . getType ( ) ) ; } catch ( NotFoundException e ) { System . err . println ( "Failed to get non-existent instance: " + e . getMessage ( ) ) ; } // [END bigtable_get_instance] return instance ; }
Demonstrates how to get an instance .