Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
a44cc95
Generate with models
drielenr Nov 22, 2023
05d6d12
Update typespec to fix some build erros
drielenr Nov 28, 2023
53aad04
temporary suppress namespece not registered error AZC0001
drielenr Nov 28, 2023
f571647
Merge branch 'main' into drielene/generateWithModels
drielenr Nov 28, 2023
bad64cc
Regenerate after merging main
drielenr Nov 28, 2023
5853efa
Merge branch 'main' into drielene/generateWithModels
drielenr Dec 11, 2023
1511ac8
some tsp updates after meeting
drielenr Dec 14, 2023
22f5688
Merge branch 'main' into drielene/generateWithModels
drielenr Dec 14, 2023
7252e29
generate after fix for projectedName enums
drielenr Dec 14, 2023
35ace7b
Add customizations
drielenr Dec 14, 2023
e4bca29
Merge branch 'main' into drielene/generateWithModels
drielenr Jan 2, 2024
9c558e2
regenerate after merge main
drielenr Jan 2, 2024
3ca1712
update tests to use model
drielenr Jan 4, 2024
5b737dd
Updates for live test
drielenr Jan 11, 2024
216b0b4
Refactor and update tests
drielenr Jan 12, 2024
4b9c0b0
Final update tests
drielenr Jan 16, 2024
954f62b
remove old samples
drielenr Jan 16, 2024
c93c747
wrup-up all the tests
drielenr Jan 16, 2024
eaa2b66
update assets repo
drielenr Jan 16, 2024
7c49ebf
Customizae AzureLocation and ResourceId as they are unsupported tsp t…
drielenr Jan 16, 2024
13a2f58
Use model instead of Response<model> from tests
drielenr Jan 17, 2024
3bcc5f3
Regenerate after customizations and tsp updates
drielenr Jan 17, 2024
e2eafd1
Revert "remove old samples"
drielenr Jan 17, 2024
c2f7a31
remove Response from DevCenterClient
drielenr Jan 17, 2024
7bab311
Update samples and readme
drielenr Jan 18, 2024
f6b02c3
Update API
drielenr Jan 18, 2024
227e452
Update version
drielenr Jan 18, 2024
3e295f8
Update Changelog
drielenr Jan 18, 2024
24c37e7
Update latest tsp commit
drielenr Jan 18, 2024
e1b0304
Merge branch 'main' into drielene/generateWithModels
drielenr Jan 18, 2024
864f8bc
Remove suppress namespace error
drielenr Jan 19, 2024
cee6fe2
Remove auto-generated from custom and unecessary package usage
drielenr Jan 22, 2024
9a5632c
Tsp enforced updates: type bytes for BinaryData and camelCase
drielenr Jan 22, 2024
a31a58b
Customize BinaryData deserialization
drielenr Jan 22, 2024
8c708b7
revert casing due to serialization
drielenr Jan 22, 2024
b76a10b
Remove recorded test only, to integrate with live tests pipelines
drielenr Jan 22, 2024
8854cc7
Merge branch 'main' into drielene/generateWithModels
drielenr Jan 23, 2024
92c6993
Customize create devbox convenience API
drielenr Jan 31, 2024
3103c99
Merge branch 'main' into drielene/generateWithModels
drielenr Jan 31, 2024
1caa54b
Regen after merge
drielenr Feb 1, 2024
ae128fe
Add package reference for client model
drielenr Feb 1, 2024
ae74528
Use some tsp standard operations and remove filter maxCount queries
drielenr Feb 2, 2024
cb40a9a
Merge branch 'main' into drielene/generateWithModels
drielenr Feb 16, 2024
be4bec2
gen after merge. TODO: update custom serialization for EnvDef and Env…
drielenr Feb 16, 2024
52ad5a6
Powerstate optional, schedule time type, env def default type
drielenr Feb 21, 2024
0c90a32
Update parameter type
drielenr Feb 22, 2024
865a6d2
Update ParametersSchema type
drielenr Feb 22, 2024
e43ecd4
remove customization for environment definition
drielenr Feb 22, 2024
7fc5a59
Regen after deleting customizations
drielenr Feb 22, 2024
cd5c665
update parameter message for userid
drielenr Feb 23, 2024
c242ba7
use Dictionary<string, BinaryData> for environment parameter
drielenr Feb 23, 2024
18afb86
use stadard operations for actions
drielenr Feb 26, 2024
f4bb40f
update api
drielenr Feb 29, 2024
8ef07c2
fix catalog path
drielenr Mar 1, 2024
69d836d
Add test resource deployment
drielenr Mar 1, 2024
4773f81
Add Dev Center Custom Credential
drielenr Mar 2, 2024
37fdb2e
Use path combine for authority
drielenr Mar 4, 2024
9b7e265
remove unused property
drielenr Mar 4, 2024
18fd9f9
Increase timeout limit
drielenr Mar 4, 2024
1f8f0bd
Decrease dev box size for tests
drielenr Mar 4, 2024
8947d03
Fix authority host
drielenr Mar 5, 2024
5fc3f4b
Move test environment to a separe folder
drielenr Mar 5, 2024
d12bc79
Update parameter schema type
drielenr Mar 5, 2024
54de410
Merge branch 'main' into drielene/generateWithModels
drielenr Mar 5, 2024
b377821
Regen after merging main
drielenr Mar 5, 2024
83eee77
Revert "Update parameter schema type"
drielenr Mar 5, 2024
7ae5638
Rename for schedule
drielenr Mar 7, 2024
fd642dc
Update api
drielenr Mar 7, 2024
046bf7a
Merge branch 'main' into drielene/generateWithModels
drielenr Mar 14, 2024
0555547
Regen after merging main
drielenr Mar 14, 2024
b12dee5
Remove AzureLocation from customization as this type is now supported…
drielenr Mar 14, 2024
5697560
ParametersSchema back to string type
drielenr Mar 14, 2024
0d58a8a
standard way of checking null argument
drielenr Mar 14, 2024
c84270d
Add @typespec/json-schema package
drielenr Mar 14, 2024
7bcb78c
Revert "Add @typespec/json-schema package"
drielenr Mar 15, 2024
e69f3e6
Run script code check
drielenr Mar 15, 2024
f16a5fe
Customize deployment environment to take environment name in the cons…
drielenr Mar 18, 2024
c4955e2
Update custom dev box
drielenr Mar 18, 2024
8d8505a
Rename to delay status
drielenr Mar 18, 2024
da3d1c2
Update api
drielenr Mar 19, 2024
b4db5ef
Add and update samples
drielenr Mar 19, 2024
0a25dcb
Update to the merged tsp commit hash
drielenr Mar 19, 2024
bd71d0f
Merge branch 'main' into drielene/generateWithModels
drielenr Mar 19, 2024
b5ff3c4
Regen after merge main
drielenr Mar 20, 2024
54c37be
Fix broken link reference
drielenr Mar 20, 2024
82e8342
Merge branch 'main' into drielene/generateWithModels
drielenr Mar 21, 2024
7a8439e
Regen after merge main
drielenr Mar 21, 2024
c96aa65
Update commit hash
drielenr Mar 21, 2024
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
8 changes: 7 additions & 1 deletion sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
## 1.0.0 (Unreleased)
This Azure DevCenter library release uses the 2023-04-01 GA API.

### Features Added

- Added models and models serialization for each Dev Center concept
- Added methods in the clients returning the serialized model, not only BinaryData

### Breaking Changes

- Renamed `AzureDeveloperDevCenterClientOptions` back to `DevCenterClientOptions`

### Bugs Fixed

### Other Changes
Expand Down
121 changes: 66 additions & 55 deletions sdk/devcenter/Azure.Developer.DevCenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ var devBoxesClient = new DevBoxesClient(endpoint, credential);
var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential);
```

Alternatively use `DevCenterClient` to create `DevBoxesClient` and `DeploymentEnvironmentsClient` sharing same endpoint and credential across clients.

```C# Snippet:Azure_DevCenter_CreateClientsFromDevCenterClient_Scenario
devBoxesClient = devCenterClient.GetDevBoxesClient();
environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient();
```

### Thread safety

We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Expand All @@ -76,61 +83,57 @@ You can familiarize yourself with different APIs using [Samples](https://github.
`DevCenterClient` allows you to list projects and retrieve projects by their name.

```C# Snippet:Azure_DevCenter_GetProjects_Scenario
string targetProjectName = null;
await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
targetProjectName = result.GetProperty("name").ToString();
}
string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com";
var endpoint = new Uri(devCenterUri);
var credential = new DefaultAzureCredential();
var devCenterClient = new DevCenterClient(endpoint, credential);

List<DevCenterProject> projects = await devCenterClient.GetProjectsAsync().ToEnumerableAsync();
var projectName = projects.FirstOrDefault().Name;
```

### List available Dev Box Pools

Interaction with DevBox pools is facilitated through the `DevBoxesClient`. Pools can be listed for a specific project or fetched individually.

```C# Snippet:Azure_DevCenter_GetPools_Scenario
string targetPoolName = null;
await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName, null, null, null))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
targetPoolName = result.GetProperty("name").ToString();
}
// Create DevBox-es client from existing DevCenter client
var devBoxesClient = devCenterClient.GetDevBoxesClient();

// Grab a pool
List<DevBoxPool> pools = await devBoxesClient.GetPoolsAsync(projectName).ToEnumerableAsync();
var poolName = pools.FirstOrDefault().Name;
```

### Provision a Dev Box

To create a new DevBox, provide the pool name in the content and specify the desired DevBox name. Upon successful execution of this operation, a DevBox should appear in the portal.

```C# Snippet:Azure_DevCenter_CreateDevBox_Scenario
var content = new
{
poolName = targetPoolName,
};
var devBoxName = "MyDevBox";
var devBox = new DevBox(devBoxName, poolName);

Operation<BinaryData> devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(
Operation<DevBox> devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(
WaitUntil.Completed,
targetProjectName,
projectName,
"me",
"MyDevBox",
RequestContent.Create(content));
devBox);

BinaryData devBoxData = await devBoxCreateOperation.WaitForCompletionAsync();
JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).RootElement;
Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetProperty("provisioningState")}.");
devBox = await devBoxCreateOperation.WaitForCompletionAsync();
Console.WriteLine($"Completed provisioning for dev box with status {devBox.ProvisioningState}.");
```

### Connect to your Dev Box

Once a DevBox is provisioned, you can connect to it using an RDP connection string. Below is a sample code that demonstrates how to retrieve it.

```C# Snippet:Azure_DevCenter_ConnectToDevBox_Scenario
Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync(
targetProjectName,
RemoteConnection remoteConnection = await devBoxesClient.GetRemoteConnectionAsync(
projectName,
"me",
"MyDevBox",
null);
JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement;
Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}.");
devBoxName);

Console.WriteLine($"Connect using web URL {remoteConnection.WebUri}.");
```

### Delete the Dev Box
Expand All @@ -140,9 +143,9 @@ Deleting a DevBox is easy. It's much faster operation than creating a new DevBox
```C# Snippet:Azure_DevCenter_DeleteDevBox_Scenario
Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync(
WaitUntil.Completed,
targetProjectName,
projectName,
"me",
"MyDevBox");
devBoxName);
await devBoxDeleteOperation.WaitForCompletionResponseAsync();
Console.WriteLine($"Completed dev box deletion.");
```
Expand All @@ -152,64 +155,72 @@ Console.WriteLine($"Completed dev box deletion.");
`DeploymentEnvironmentsClient` can be used to issue a request to get all catalogs in a project.

```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario
string catalogName = null;
// Create deployment environments client from existing DevCenter client
var environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient();

await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName, null, null))
//List all catalogs and grab the first one
//Using foreach, but could also use a List
string catalogName = default;
await foreach (DevCenterCatalog catalog in environmentsClient.GetCatalogsAsync(projectName))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
catalogName = result.GetProperty("name").ToString();
catalogName = catalog.Name;
break;
}
Console.WriteLine($"Using catalog {catalogName}");
```

## Get all environment definitions in a project for a catalog

Environment definitions are a part of the catalog associated with your project. If you don't see the expected environment definitions in the results, please ensure that you have pushed your changes to the catalog repository and synchronized the catalog.

```C# Snippet:Azure_DevCenter_GetEnvironmentDefinitionsFromCatalog_Scenario
string environmentDefinitionName = null;
await foreach (BinaryData data in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName, maxCount: 1, context: new()))
//List all environment definition for a catalog and grab the first one
string environmentDefinitionName = default;
await foreach (EnvironmentDefinition environmentDefinition in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
environmentDefinitionName = result.GetProperty("name").ToString();
environmentDefinitionName = environmentDefinition.Name;
break;
}
Console.WriteLine($"Using environment definition {environmentDefinitionName}");
```

## Get all environment types in a project

Issue a request to get all environment types in a project.

```C# Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario
string environmentTypeName = null;
await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName, null, null))
//List all environment types and grab the first one
string environmentTypeName = default;
await foreach (DevCenterEnvironmentType environmentType in environmentsClient.GetEnvironmentTypesAsync(projectName))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
environmentTypeName = result.GetProperty("name").ToString();
environmentTypeName = environmentType.Name;
break;
}
Console.WriteLine($"Using environment type {environmentTypeName}");
```

## Create an environment

Issue a request to create an environment using a specific definition item and environment type.

```C# Snippet:Azure_DevCenter_CreateEnvironment_Scenario
var content = new
{
catalogName = catalogName,
environmentType = environmentTypeName,
environmentDefinitionName = environmentDefinitionName,
};
var requestEnvironment = new DevCenterEnvironment
(
"DevEnvironment",
environmentTypeName,
catalogName,
environmentDefinitionName
);

// Deploy the environment
Operation<BinaryData> environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(
Operation<DevCenterEnvironment> environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(
WaitUntil.Completed,
projectName,
"me",
"DevEnvironment",
RequestContent.Create(content));
requestEnvironment);

BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync();
JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement;
Console.WriteLine($"Completed provisioning for environment with status {environment.GetProperty("provisioningState")}.");
DevCenterEnvironment environment = await environmentCreateOperation.WaitForCompletionAsync();
Console.WriteLine($"Completed provisioning for environment with status {environment.ProvisioningState}.");
```

## Delete an environment
Expand Down
Loading