Thanks! A couple hints to do this properly:

Is there any way we can determine if the `ContextBuilder` was created for 
China? (For example by looking at the `endpoint` that has been configured?

If we can determine that, then I'd suggest the following approach to make the 
whole thing configurable:

1. Create a `@Provides` method in the Http API Module, that gets the endpoint 
(or whatever that allows us to know if it is China), and returns a boolean 
saying if we're in China or not. We can also qualify that method with a name. 
The idea is to be able to inject that `isChina` boolean wherever we need it.
2. Modify the 
[GraphRBAC](https://github.com/jclouds/jclouds/blob/master/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/GraphRBAC.java)
 endpoint supplier to get the `isChina` boolean injected and produce the right 
URI in its `get()` method.
3. Modify the 
[OAuthResource](https://github.com/jclouds/jclouds/blob/master/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/OAuthResource.java)
 to accept a second value (`String china()` or similar) so we can use the 
annotation to configure the normal endpoint and the endpoint for China regions.
4. Modify the 
[AzureOAuthConfigFactory](https://github.com/jclouds/jclouds/blob/master/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/config/AzureOAuthConfigFactory.java)
 to get the `isChina` boolean injected and take it into account to read the 
right field of the `OAuthResource` annotation and return the right endpoint.

With this we should be good to get the right endpoints automatically configured.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1237#issuecomment-417249540

Reply via email to