Azure SDK for Java Reference Documentation

Current version is 1.0.0-beta.1, 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.1</version>
</dependency>

Authentication

Azure Identity package provides the default implementation for authenticating the client.

Key concepts

Examples

Dev Box Scenarios

String tenantId = Configuration.getGlobalConfiguration().get("AZURE_TENANT_ID");
String devCenterName = Configuration.getGlobalConfiguration().get("DEVCENTER_NAME");

// Build our clients
DevCenterClient devCenterClient =
                new DevCenterClientBuilder()
                        .devCenter(devCenterName)
                        .tenantId(tenantId)
                        .credential(new DefaultAzureCredentialBuilder().build())
                        .buildClient();

DevBoxesClient devBoxClient =
                new DevBoxesClientBuilder()
                        .devCenter(devCenterName)
                        .tenantId(tenantId)
                        .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()
                        .devCenter(devCenterName)
                        .tenantId(tenantId)
                        .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();


// Fetch the deployment artifacts:
PagedIterable<BinaryData> artifactListResponse = environmentsClient.listArtifactsByEnvironment("myProject", "me", "TestEnvironment", null);
for (BinaryData p: artifactListResponse) {
    System.out.println(p);
}


// 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.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Packages
Package
Description
Package containing the classes for DevCenter.