Azure DevCenter client library for Java - version 1.0.0-beta.3
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.3</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
DeploymentEnvironmentsClient environmentsClient =
new DeploymentEnvironmentsClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
// Fetch available environment definitions and environment types
PagedIterable<BinaryData> listCatalogsResponse = environmentsClient.listCatalogs("myProject", null);
for (BinaryData p: listCatalogsResponse) {
System.out.println(p);
}
PagedIterable<BinaryData> environmentDefinitionsListResponse = environmentsClient.listEnvironmentDefinitionsByCatalog("myProject", "myCatalog", null);
for (BinaryData p: environmentDefinitionsListResponse) {
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("{\"environmentDefinitionName\":\"myEnvironmentDefinition\", \"environmentType\":\"myEnvironmentType\", \"catalogName\":\"myCatalog\"}");
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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for