void updateFromResponseOnPutPatch ( Response < ResponseBody > response ) throws CloudException , IOException { String responseContent = null ; if ( response . body ( ) != null ) { responseContent = response . body ( ) . string ( ) ; response . body ( ) . close ( ) ; } if ( responseContent == null || responseContent . isEmpty ( ) ) { throw new CloudException ( "polling response does not contain a valid body" , response ) ; } PollingResource resource = serializerAdapter . deserialize ( responseContent , PollingResource . class ) ; final int statusCode = response . code ( ) ; if ( resource != null && resource . properties != null && resource . properties . provisioningState != null ) { this . withStatus ( resource . properties . provisioningState , statusCode ) ; } else { this . withStatus ( AzureAsyncOperation . SUCCESS_STATUS , statusCode ) ; } CloudError error = new CloudError ( ) ; this . withErrorBody ( error ) ; error . withCode ( this . status ( ) ) ; error . withMessage ( "Long running operation failed" ) ; this . withResponse ( response ) ; this . withResource ( serializerAdapter . < T > deserialize ( responseContent , resourceType ) ) ; }
Updates the polling state from a PUT or PATCH operation .