public static ApiOvhCore getInstance ( ) { ApiOvhCore core = new ApiOvhCore ( ) ; // core._consumerKey = core.config.getConsumerKey(); core . _consumerKey = core . getConsumerKeyOrNull ( ) ; // config.getConsumerKey(); if ( core . _consumerKey == null ) { File file = ApiOvhConfigBasic . getOvhConfig ( ) ; String location = ApiOvhConfigBasic . configFiles ; if ( file != null ) location = file . getAbsolutePath ( ) ; String url = "" ; String CK = "" ; try { OvhCredential credential = core . requestToken ( null ) ; url = credential . validationUrl ; CK = credential . consumerKey ; } catch ( Exception e ) { log . error ( "Fail to request a new Credential" , e ) ; } log . error ( "activate the CK {} here: {}" , CK , url ) ; throw new NullPointerException ( "no 'consumer_key' present in " + location + " or environement 'OVH_CONSUMER_KEY', activate the CK '" + CK + "' here: " + url ) ; } return core ; }
Connect to the OVH API using a consumerKey contains in your ovh config file or environment variable