use of com.microsoft.azure.serializer.AzureJacksonAdapter in project azure-sdk-for-java by Azure.
the class ManageSqlFirewallRules method main.
/**
* Main entry point.
* @param args the parameters
*/
public static void main(String[] args) {
try {
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
RestClient restClient = new RestClient.Builder().withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER).withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withReadTimeout(150, TimeUnit.SECONDS).withLogLevel(LogLevel.BODY).withCredentials(credentials).build();
Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
use of com.microsoft.azure.serializer.AzureJacksonAdapter in project autorest.java by Azure.
the class SubscriptionInCredentialsTests method setup.
@BeforeClass
public static void setup() {
RestClient restClient = new RestClient.Builder().withBaseUrl("http://localhost:3000").withCredentials(new TokenCredentials(null, UUID.randomUUID().toString())).withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withInterceptor(new RequestIdHeaderInterceptor()).build();
client = new AutoRestAzureSpecialParametersTestClientImpl(restClient);
client.withSubscriptionId("1234-5678-9012-3456");
}
use of com.microsoft.azure.serializer.AzureJacksonAdapter in project autorest.java by Azure.
the class LROsTests method setup.
@BeforeClass
public static void setup() {
RestClient restClient = new RestClient.Builder().withBaseUrl("http://localhost:3000").withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).build();
client = new AutoRestLongRunningOperationTestServiceImpl(restClient);
client.getAzureClient().setLongRunningOperationRetryTimeout(0);
}
use of com.microsoft.azure.serializer.AzureJacksonAdapter in project azure-tools-for-java by Microsoft.
the class IntegrationTestBase method createRestClient.
private RestClient createRestClient(ApplicationTokenCredentials credentials) throws Exception {
RestClient restClient;
if (IS_MOCKED) {
credentials = new TestCredentials();
restClient = new RestClient.Builder().withBaseUrl(MOCK_URI + "/").withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials).withLogLevel(LogLevel.BODY_AND_HEADERS).withInterceptor(interceptor).build();
return restClient;
} else {
restClient = new RestClient.Builder().withBaseUrl(GLOBAL_ENDPOINT).withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials).withLogLevel(LogLevel.BODY_AND_HEADERS).withInterceptor(interceptor).build();
return restClient;
}
}
use of com.microsoft.azure.serializer.AzureJacksonAdapter in project azure-tools-for-java by Microsoft.
the class IntegrationTestBase method createRestClient.
private RestClient createRestClient(ApplicationTokenCredentials credentials) {
final RestClient client;
ApplicationTokenCredentials cred = credentials;
if (IS_MOCKED) {
cred = new TestCredentials();
client = new RestClient.Builder().withBaseUrl(MOCK_URI + "/").withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(cred).withLogLevel(LogLevel.BODY_AND_HEADERS).withInterceptor(interceptor).build();
} else {
client = new RestClient.Builder().withBaseUrl(GLOBAL_ENDPOINT).withSerializerAdapter(new AzureJacksonAdapter()).withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(cred).withLogLevel(LogLevel.BODY_AND_HEADERS).withInterceptor(interceptor).build();
}
return client;
}
Aggregations