Skip to content

Commit 759494f

Browse files
chrissmilleralzimmermsftsebrenna
authored
Add Azure DevCenter SDK (Azure#31300)
* Adding generated code * Adding samples * Add tests * Update pom, ci, and cleanup style warnings * Adding recordings for live tests * Update version_client.txt * Update versions * Update READMEs and samples * Add readme structure * Fix tenant env variable * Update sdk/devcenter/azure-developer-devcenter/pom.xml Co-authored-by: Alan Zimmer <[email protected]> * addressing pull request comments Co-authored-by: Alan Zimmer <[email protected]> Co-authored-by: Sean Brennan <[email protected]>
1 parent 359bfba commit 759494f

File tree

97 files changed

+15622
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+15622
-0
lines changed

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ com.azure:azure-data-schemaregistry-apacheavro;1.1.0;1.2.0-beta.1
101101
com.azure:azure-data-tables;12.3.5;12.4.0-beta.1
102102
com.azure:azure-data-tables-perf;1.0.0-beta.1;1.0.0-beta.1
103103
com.azure:azure-digitaltwins-core;1.3.3;1.4.0-beta.1
104+
com.azure:azure-developer-devcenter;1.0.0-beta.1;1.0.0-beta.1
104105
com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1
105106
com.azure:azure-identity;1.6.1;1.7.0-beta.3
106107
com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
5+
- This package contains Microsoft Azure DevCenter client library.
6+
7+
### Features Added
8+
Initial release for the azure-developer-devcenter Java SDK.
9+
10+
### Breaking Changes
11+
12+
### Bugs Fixed
13+
14+
### Other Changes
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Azure DevCenter client library for Java
2+
3+
This package contains Microsoft Azure DevCenter client library.
4+
5+
## Documentation
6+
7+
Various documentation is available to help you get started
8+
9+
- [Product documentation: Azure Deployment Environments][environments_documentation]
10+
- [Product documentation: Microsoft Dev Box][devbox_documentation]
11+
12+
## Getting started
13+
14+
### Prerequisites
15+
16+
- [Java Development Kit (JDK)][jdk] with version 8 or above
17+
- [Azure Subscription][azure_subscription]
18+
- The minimum requirements to create Dev Box resources using this SDK are to create DevCenter, Project, and Pool resources.
19+
- The minimum requirements to create Environment resources using this SDK are to create DevCenter, Project, EnvironmentType, and CatalogItem resources.
20+
21+
### Adding the package to your product
22+
23+
[//]: # ({x-version-update-start;com.azure:azure-developer-devcenter;current})
24+
```xml
25+
<dependency>
26+
<groupId>com.azure</groupId>
27+
<artifactId>azure-developer-devcenter</artifactId>
28+
<version>1.0.0-beta.1</version>
29+
</dependency>
30+
```
31+
[//]: # ({x-version-update-end})
32+
33+
### Authentication
34+
35+
[Azure Identity][azure_identity] package provides the default implementation for authenticating the client.
36+
37+
## Key concepts
38+
39+
## Examples
40+
### Dev Box Scenarios
41+
```java com.azure.developer.devcenter.readme.devboxes
42+
String tenantId = Configuration.getGlobalConfiguration().get("AZURE_TENANT_ID");
43+
String devCenterName = Configuration.getGlobalConfiguration().get("DEVCENTER_NAME");
44+
45+
// Build our clients
46+
DevCenterClient devCenterClient =
47+
new DevCenterClientBuilder()
48+
.devCenter(devCenterName)
49+
.tenantId(tenantId)
50+
.credential(new DefaultAzureCredentialBuilder().build())
51+
.buildClient();
52+
53+
DevBoxesClient devBoxClient =
54+
new DevBoxesClientBuilder()
55+
.devCenter(devCenterName)
56+
.tenantId(tenantId)
57+
.credential(new DefaultAzureCredentialBuilder().build())
58+
.buildClient();
59+
60+
// Find available Projects and Pools
61+
PagedIterable<BinaryData> projectListResponse = devCenterClient.listProjects(null);
62+
for (BinaryData p: projectListResponse) {
63+
System.out.println(p);
64+
}
65+
66+
PagedIterable<BinaryData> poolListResponse = devBoxClient.listPools("myProject", null);
67+
for (BinaryData p: poolListResponse) {
68+
System.out.println(p);
69+
}
70+
71+
// Provision a Dev Box
72+
BinaryData devBoxBody = BinaryData.fromString("{\"poolName\":\"MyPool\"}");
73+
SyncPoller<BinaryData, BinaryData> devBoxCreateResponse =
74+
devBoxClient.beginCreateDevBox("myProject", "me", "MyDevBox", devBoxBody, null);
75+
devBoxCreateResponse.waitForCompletion();
76+
77+
78+
Response<BinaryData> remoteConnectionResponse =
79+
devBoxClient.getRemoteConnectionWithResponse("myProject", "me", "MyDevBox", null);
80+
System.out.println(remoteConnectionResponse.getValue());
81+
82+
// Tear down the Dev Box when we're finished:
83+
SyncPoller<BinaryData, BinaryData> devBoxDeleteResponse =
84+
devBoxClient.beginDeleteDevBox("myProject", "me", "MyDevBox", null);
85+
devBoxDeleteResponse.waitForCompletion();
86+
```
87+
88+
### Environments Scenarios
89+
```java com.azure.developer.devcenter.readme.environments
90+
EnvironmentsClient environmentsClient =
91+
new EnvironmentsClientBuilder()
92+
.devCenter(devCenterName)
93+
.tenantId(tenantId)
94+
.credential(new DefaultAzureCredentialBuilder().build())
95+
.buildClient();
96+
97+
// Fetch available catalog items and environment types
98+
PagedIterable<BinaryData> catalogItemListResponse = environmentsClient.listCatalogItems("myProject", null);
99+
for (BinaryData p: catalogItemListResponse) {
100+
System.out.println(p);
101+
}
102+
103+
PagedIterable<BinaryData> environmentTypesListResponse = environmentsClient.listEnvironmentTypes("myProject", null);
104+
for (BinaryData p: environmentTypesListResponse) {
105+
System.out.println(p);
106+
}
107+
108+
// Create an environment
109+
BinaryData environmentBody = BinaryData.fromString("{\"catalogItemName\":\"MyCatalogItem\", \"environmentType\":\"MyEnvironmentType\"}");
110+
SyncPoller<BinaryData, BinaryData> environmentCreateResponse =
111+
environmentsClient.beginCreateOrUpdateEnvironment("myProject", "me", "TestEnvironment", environmentBody, null);
112+
environmentCreateResponse.waitForCompletion();
113+
114+
115+
// Fetch the deployment artifacts:
116+
PagedIterable<BinaryData> artifactListResponse = environmentsClient.listArtifactsByEnvironment("myProject", "me", "TestEnvironment", null);
117+
for (BinaryData p: artifactListResponse) {
118+
System.out.println(p);
119+
}
120+
121+
122+
// Delete the environment when we're finished:
123+
SyncPoller<BinaryData, BinaryData> environmentDeleteResponse =
124+
environmentsClient.beginDeleteEnvironment("myProject", "me", "TestEnvironment", null);
125+
environmentDeleteResponse.waitForCompletion();
126+
```
127+
128+
## Troubleshooting
129+
130+
## Next steps
131+
132+
## Contributing
133+
134+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
135+
136+
1. Fork it
137+
1. Create your feature branch (`git checkout -b my-new-feature`)
138+
1. Commit your changes (`git commit -am 'Add some feature'`)
139+
1. Push to the branch (`git push origin my-new-feature`)
140+
1. Create new Pull Request
141+
142+
<!-- LINKS -->
143+
[environments_documentation]: https://learn.microsoft.com/azure/deployment-environments/
144+
[devbox_documentation]: https://learn.microsoft.com/azure/dev-box/
145+
[docs]: https://azure.github.io/azure-sdk-for-java/
146+
[jdk]: https://docs.microsoft.com/java/azure/jdk/
147+
[azure_subscription]: https://azure.microsoft.com/free/
148+
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>com.azure</groupId>
5+
<artifactId>azure-client-sdk-parent</artifactId>
6+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
7+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
8+
</parent>
9+
10+
<groupId>com.azure</groupId>
11+
<artifactId>azure-developer-devcenter</artifactId>
12+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-developer-devcenter;current} -->
13+
<packaging>jar</packaging>
14+
15+
<name>Microsoft Azure SDK for DevCenter Management</name>
16+
<description>This package contains Microsoft Azure DevCenter client library.</description>
17+
<url>https://github.com/Azure/azure-sdk-for-java</url>
18+
19+
<licenses>
20+
<license>
21+
<name>The MIT License (MIT)</name>
22+
<url>http://opensource.org/licenses/MIT</url>
23+
<distribution>repo</distribution>
24+
</license>
25+
</licenses>
26+
27+
<scm>
28+
<url>https://github.com/Azure/azure-sdk-for-java</url>
29+
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
30+
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
31+
<tag>HEAD</tag>
32+
</scm>
33+
<developers>
34+
<developer>
35+
<id>microsoft</id>
36+
<name>Microsoft</name>
37+
</developer>
38+
</developers>
39+
<properties>
40+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41+
<jacoco.min.linecoverage>0.25</jacoco.min.linecoverage>
42+
<jacoco.min.branchcoverage>0.15</jacoco.min.branchcoverage>
43+
</properties>
44+
<dependencies>
45+
<dependency>
46+
<groupId>com.azure</groupId>
47+
<artifactId>azure-core</artifactId>
48+
<version>1.33.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
49+
</dependency>
50+
<dependency>
51+
<groupId>com.azure</groupId>
52+
<artifactId>azure-core-http-netty</artifactId>
53+
<version>1.12.6</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
54+
</dependency>
55+
<dependency>
56+
<groupId>org.junit.jupiter</groupId>
57+
<artifactId>junit-jupiter-engine</artifactId>
58+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.mockito</groupId>
63+
<artifactId>mockito-core</artifactId>
64+
<version>4.5.1</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
65+
<scope>test</scope>
66+
</dependency>
67+
<dependency>
68+
<groupId>com.azure</groupId>
69+
<artifactId>azure-core-test</artifactId>
70+
<version>1.12.1</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
71+
<scope>test</scope>
72+
</dependency>
73+
<dependency>
74+
<groupId>com.azure</groupId>
75+
<artifactId>azure-identity</artifactId>
76+
<version>1.6.1</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
77+
<scope>test</scope>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.slf4j</groupId>
81+
<artifactId>slf4j-simple</artifactId>
82+
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
83+
<scope>test</scope>
84+
</dependency>
85+
</dependencies>
86+
</project>

0 commit comments

Comments
 (0)