OpenstackClient client;
public OpenstackClient getOpenstackClient() throws RestClientException {
if (client == null) {
MetadataClient metadataClient = MetadataClient.INSTANCE;
String serviceToken = metadataClient.getSecretString("token");
serviceToken = serviceToken.trim();
Metadata metadata = getMetadata();
URI identityEndpoint = URI.create(metadata.getTopLevel("identity_uri"));
HttpClient httpClient = metadataClient.getHttpClient();
OpenstackIdentityClient identityClient = new OpenstackIdentityClient(httpClient, identityEndpoint, null);
StaticTokenProvider tokenProvider = new StaticTokenProvider(identityClient, serviceToken);
this.client = OpenstackClient.build(tokenProvider);