Skip to content
Closed
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
4 changes: 3 additions & 1 deletion sdk/devspaces/azure-resourcemanager-devspaces/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
## 1.0.0-beta.1 (2025-04-30)

- Azure Resource Manager DevSpaces client library for Java. This package contains Microsoft Azure SDK for DevSpaces Management SDK. Dev Spaces Client. Package tag package-2019-04-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
6 changes: 2 additions & 4 deletions sdk/devspaces/azure-resourcemanager-devspaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
.build();
DevSpacesManager manager = DevSpacesManager
.authenticate(credential, profile);
```

The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.
The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise.

See [Authentication][authenticate] for more options.

Expand Down Expand Up @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md
[coc]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/


170 changes: 85 additions & 85 deletions sdk/devspaces/azure-resourcemanager-devspaces/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,50 @@
### ContainerHostMappings_GetContainerHostMapping

```java
import com.azure.resourcemanager.devspaces.fluent.models.ContainerHostMappingInner;

/**
* Samples for ContainerHostMappings GetContainerHostMapping.
* Samples for Controllers ListByResourceGroup.
*/
public final class ContainerHostMappingsGetContainerHostMappingSamples {
public final class ControllersListByResourceGroupSamples {
/*
* x-ms-original-file: specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/
* ContainerHostMappingsGetContainerHostMapping_example.json
* ControllersListByResourceGroup_example.json
*/
/**
* Sample code: ContainerHostMappingsGetContainerHostMapping.
* Sample code: ControllersListByResourceGroup.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void
containerHostMappingsGetContainerHostMapping(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.containerHostMappings()
.getContainerHostMappingWithResponse("myResourceGroup", "eastus",
new ContainerHostMappingInner().withContainerHostResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"),
com.azure.core.util.Context.NONE);
public static void controllersListByResourceGroup(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE);
}
}
```

### Controllers_Create

```java
/**
* Samples for Controllers List.
*/
public final class ControllersListSamples {
/*
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersList_example.
* json
*/
/**
* Sample code: ControllersList.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersList(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().list(com.azure.core.util.Context.NONE);
}
}
```

### Controllers_Delete

```java
import com.azure.resourcemanager.devspaces.models.Sku;
import com.azure.resourcemanager.devspaces.models.SkuName;
Expand Down Expand Up @@ -93,49 +109,29 @@ public final class ControllersCreateSamples {
}
```

### Controllers_Delete

```java
/**
* Samples for Controllers Delete.
*/
public final class ControllersDeleteSamples {
/*
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersDelete_example
* .json
*/
/**
* Sample code: ControllersDelete.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersDelete(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().delete("myResourceGroup", "myControllerResource", com.azure.core.util.Context.NONE);
}
}
```

### Controllers_GetByResourceGroup

```java
import com.azure.resourcemanager.devspaces.models.ListConnectionDetailsParameters;

/**
* Samples for Controllers GetByResourceGroup.
* Samples for Controllers ListConnectionDetails.
*/
public final class ControllersGetByResourceGroupSamples {
public final class ControllersListConnectionDetailsSamples {
/*
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersGet_example.
* json
* x-ms-original-file: specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/
* ControllersListConnectionDetails_example.json
*/
/**
* Sample code: ControllersGet.
* Sample code: ControllersListConnectionDetails.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersGet(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
public static void controllersListConnectionDetails(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers()
.getByResourceGroupWithResponse("myResourceGroup", "myControllerResource",
.listConnectionDetailsWithResponse("myResourceGroup", "myControllerResource",
new ListConnectionDetailsParameters().withTargetContainerHostResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"),
com.azure.core.util.Context.NONE);
}
}
Expand All @@ -144,77 +140,58 @@ public final class ControllersGetByResourceGroupSamples {
### Controllers_List

```java
/**
* Samples for Controllers List.
*/
public final class ControllersListSamples {
/*
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersList_example.
* json
*/
/**
* Sample code: ControllersList.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersList(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().list(com.azure.core.util.Context.NONE);
}
}
```

### Controllers_ListByResourceGroup
import com.azure.resourcemanager.devspaces.fluent.models.ContainerHostMappingInner;

```java
/**
* Samples for Controllers ListByResourceGroup.
* Samples for ContainerHostMappings GetContainerHostMapping.
*/
public final class ControllersListByResourceGroupSamples {
public final class ContainerHostMappingsGetContainerHostMappingSamples {
/*
* x-ms-original-file: specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/
* ControllersListByResourceGroup_example.json
* ContainerHostMappingsGetContainerHostMapping_example.json
*/
/**
* Sample code: ControllersListByResourceGroup.
* Sample code: ContainerHostMappingsGetContainerHostMapping.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersListByResourceGroup(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE);
public static void
containerHostMappingsGetContainerHostMapping(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.containerHostMappings()
.getContainerHostMappingWithResponse("myResourceGroup", "eastus",
new ContainerHostMappingInner().withContainerHostResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"),
com.azure.core.util.Context.NONE);
}
}
```

### Controllers_ListConnectionDetails
### Controllers_ListByResourceGroup

```java
import com.azure.resourcemanager.devspaces.models.ListConnectionDetailsParameters;

/**
* Samples for Controllers ListConnectionDetails.
* Samples for Controllers GetByResourceGroup.
*/
public final class ControllersListConnectionDetailsSamples {
public final class ControllersGetByResourceGroupSamples {
/*
* x-ms-original-file: specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/
* ControllersListConnectionDetails_example.json
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersGet_example.
* json
*/
/**
* Sample code: ControllersListConnectionDetails.
* Sample code: ControllersGet.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersListConnectionDetails(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
public static void controllersGet(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers()
.listConnectionDetailsWithResponse("myResourceGroup", "myControllerResource",
new ListConnectionDetailsParameters().withTargetContainerHostResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster"),
.getByResourceGroupWithResponse("myResourceGroup", "myControllerResource",
com.azure.core.util.Context.NONE);
}
}
```

### Controllers_Update
### Controllers_ListConnectionDetails

```java
import com.azure.resourcemanager.devspaces.models.Controller;
Expand Down Expand Up @@ -259,3 +236,26 @@ public final class ControllersUpdateSamples {
}
```

### Controllers_Update

```java
/**
* Samples for Controllers Delete.
*/
public final class ControllersDeleteSamples {
/*
* x-ms-original-file:
* specification/devspaces/resource-manager/Microsoft.DevSpaces/stable/2019-04-01/examples/ControllersDelete_example
* .json
*/
/**
* Sample code: ControllersDelete.
*
* @param manager Entry point to DevSpacesManager.
*/
public static void controllersDelete(com.azure.resourcemanager.devspaces.DevSpacesManager manager) {
manager.controllers().delete("myResourceGroup", "myControllerResource", com.azure.core.util.Context.NONE);
}
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
Expand All @@ -19,9 +20,9 @@
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devspaces.fluent.DevSpacesManagementClient;
import com.azure.resourcemanager.devspaces.implementation.ContainerHostMappingsImpl;
Expand All @@ -35,6 +36,7 @@
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -101,6 +103,9 @@ public static Configurable configure() {
*/
public static final class Configurable {
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);
private static final String SDK_VERSION = "version";
private static final Map<String, String> PROPERTIES
= CoreUtils.getProperties("azure-resourcemanager-devspaces.properties");

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
Expand Down Expand Up @@ -208,12 +213,14 @@ public DevSpacesManager authenticate(TokenCredential credential, AzureProfile pr
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");

String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.devspaces")
.append("/")
.append("1.0.0-beta.3");
.append(clientVersion);
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -246,7 +253,7 @@ public DevSpacesManager authenticate(TokenCredential credential, AzureProfile pr
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=${project.version}

This file was deleted.

Loading