Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Azure DevCenter SDK #31300

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ com.azure:azure-data-schemaregistry-apacheavro;1.1.0;1.2.0-beta.1
com.azure:azure-data-tables;12.3.5;12.4.0-beta.1
com.azure:azure-data-tables-perf;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-digitaltwins-core;1.3.3;1.4.0-beta.1
com.azure:azure-developer-devcenter;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-identity;1.6.1;1.7.0-beta.3
com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1
Expand Down
14 changes: 14 additions & 0 deletions sdk/devcenter/azure-developer-devcenter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

- This package contains Microsoft Azure DevCenter client library.

### Features Added
Initial release for the azure-developer-devcenter Java SDK.

### Breaking Changes

### Bugs Fixed

### Other Changes
148 changes: 148 additions & 0 deletions sdk/devcenter/azure-developer-devcenter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Azure DevCenter client library for Java

This package contains Microsoft Azure DevCenter client library.

## Documentation

Various documentation is available to help you get started

- [Product documentation: Azure Deployment Environments][environments_documentation]
- [Product documentation: Microsoft Dev Box][devbox_documentation]

## Getting started

### Prerequisites

- [Java Development Kit (JDK)][jdk] with version 8 or above
- [Azure Subscription][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

[//]: # ({x-version-update-start;com.azure:azure-developer-devcenter;current})
```xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-developer-devcenter</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})

### Authentication

[Azure Identity][azure_identity] package provides the default implementation for authenticating the client.

## Key concepts

## Examples
### Dev Box Scenarios
```java com.azure.developer.devcenter.readme.devboxes
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, BinaryData> devBoxDeleteResponse =
devBoxClient.beginDeleteDevBox("myProject", "me", "MyDevBox", null);
devBoxDeleteResponse.waitForCompletion();
```

### Environments Scenarios
```java com.azure.developer.devcenter.readme.environments
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, BinaryData> environmentDeleteResponse =
environmentsClient.beginDeleteEnvironment("myProject", "me", "TestEnvironment", null);
environmentDeleteResponse.waitForCompletion();
```

## Troubleshooting

## Next steps

## Contributing

For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request

<!-- LINKS -->
[environments_documentation]: https://learn.microsoft.com/azure/deployment-environments/
[devbox_documentation]: https://learn.microsoft.com/azure/dev-box/
[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
86 changes: 86 additions & 0 deletions sdk/devcenter/azure-developer-devcenter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-developer-devcenter</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-developer-devcenter;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for DevCenter Management</name>
<description>This package contains Microsoft Azure DevCenter client library.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/Azure/azure-sdk-for-java</url>
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.min.linecoverage>0.25</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.15</jacoco.min.branchcoverage>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.33.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.12.6</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.12.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.1</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading