Azure SDK for Java Reference Documentation
Current version is 1.0.0-beta.2, click here for the index
Azure DevCenter client library for Java
This package contains Microsoft Azure DevCenter client library.
Documentation
Various documentation is available to help you get started
Getting started
Prerequisites
- Java Development Kit (JDK) with version 8 or above
- Azure Subscription
- The minimum requirements to create Dev Box resources using this SDK are to create DevCenter, Project, and Pool resources.
- The minimum requirements to create Environment resources using this SDK are to create DevCenter, Project, EnvironmentType, and CatalogItem resources.
Adding the package to your product
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-developer-devcenter</artifactId>
<version>1.0.0-beta.2</version>
</dependency>
Authentication
Azure Identity package provides the default implementation for authenticating the client.
Key concepts
Examples
Dev Box Scenarios
String endpoint = Configuration.getGlobalConfiguration().get("DEVCENTER_ENDPOINT");
// Build our clients
DevCenterClient devCenterClient =
new DevCenterClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
DevBoxesClient devBoxClient =
new DevBoxesClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
// Find available Projects and Pools
PagedIterable<BinaryData> projectListResponse = devCenterClient.listProjects(null);
for (BinaryData p: projectListResponse) {
System.out.println(p);
}
PagedIterable<BinaryData> poolListResponse = devBoxClient.listPools("myProject", null);
for (BinaryData p: poolListResponse) {
System.out.println(p);
}
// Provision a Dev Box
BinaryData devBoxBody = BinaryData.fromString("{\"poolName\":\"MyPool\"}");
SyncPoller<BinaryData, BinaryData> devBoxCreateResponse =
devBoxClient.beginCreateDevBox("myProject", "me", "MyDevBox", devBoxBody, null);
devBoxCreateResponse.waitForCompletion();
Response<BinaryData> remoteConnectionResponse =
devBoxClient.getRemoteConnectionWithResponse("myProject", "me", "MyDevBox", null);
System.out.println(remoteConnectionResponse.getValue());
// Tear down the Dev Box when we're finished:
SyncPoller<BinaryData, Void> devBoxDeleteResponse =
devBoxClient.beginDeleteDevBox("myProject", "me", "MyDevBox", null);
devBoxDeleteResponse.waitForCompletion();
Environments Scenarios
EnvironmentsClient environmentsClient =
new EnvironmentsClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
// Fetch available catalog items and environment types
PagedIterable<BinaryData> catalogItemListResponse = environmentsClient.listCatalogItems("myProject", null);
for (BinaryData p: catalogItemListResponse) {
System.out.println(p);
}
PagedIterable<BinaryData> environmentTypesListResponse = environmentsClient.listEnvironmentTypes("myProject", null);
for (BinaryData p: environmentTypesListResponse) {
System.out.println(p);
}
// Create an environment
BinaryData environmentBody = BinaryData.fromString("{\"catalogItemName\":\"MyCatalogItem\", \"environmentType\":\"MyEnvironmentType\"}");
SyncPoller<BinaryData, BinaryData> environmentCreateResponse =
environmentsClient.beginCreateOrUpdateEnvironment("myProject", "me", "TestEnvironment", environmentBody, null);
environmentCreateResponse.waitForCompletion();
// Delete the environment when we're finished:
SyncPoller<BinaryData, Void> environmentDeleteResponse =
environmentsClient.beginDeleteEnvironment("myProject", "me", "TestEnvironment", null);
environmentDeleteResponse.waitForCompletion();
Troubleshooting
Next steps
Contributing
For details on contributing to this repository, see the contributing guide.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request