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

[ReleasePR azure-resourcemanager-loadtesting] change loadtesting catalog #32929

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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2023-01-12)

- Azure Resource Manager LoadTest client library for Java. This package contains Microsoft Azure SDK for LoadTest Management SDK. LoadTest client provides access to LoadTest Resource and it's status operations. Package tag package-2022-12-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
161 changes: 2 additions & 159 deletions sdk/loadtesting/azure-resourcemanager-loadtesting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-loadtesting</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -55,7 +55,7 @@ In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID`

With above configuration, `azure` client can be authenticated using the following code:

```java readme-sample-authn
```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
Expand All @@ -74,163 +74,6 @@ See [API design][design] for general introduction on design and key concepts on

## Examples

### Create a new Azure Load Testing resource

Create an Azure Load Testing resource.

```java readme-sample-createloadtestresource-basic
LoadTestResource resource = manager
.loadTests()
.define("sample-loadtesting-resource")
.withRegion(Region.US_WEST2)
.withExistingResourceGroup("sample-rg")
.create();
```

Create an Azure Load Testing resource configured with CMK encryption.

```java readme-sample-createloadtestresource-encryption
// map of user-assigned managed identities to be assigned to the loadtest resource
Map<String, UserAssignedIdentity> map = new HashMap<String, UserAssignedIdentity>();
map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", new UserAssignedIdentity());

// encryption identity must be assigned to the load test resource, before using it
LoadTestResource resource = manager
.loadTests()
.define("sample-loadtesting-resource")
.withRegion(Region.US_WEST2)
.withExistingResourceGroup("sample-rg")
.withIdentity(
new ManagedServiceIdentity()
.withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(map)
)
.withEncryption(
new EncryptionProperties()
.withIdentity(
new EncryptionPropertiesIdentity()
.withResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1")
.withType(Type.USER_ASSIGNED)
)
.withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde")
)
.create();
```

### Get details of an Azure Load Testing resource

```java readme-sample-getloadtestresource
LoadTestResource resource = manager
.loadTests()
.getByResourceGroup("sample-rg", "sample-loadtesting-resource");
```

### Update an Azure Load Testing resource

Update an Azure Load Testing resource to configure CMK encryption using system-assigned managed identity.

```java readme-sample-updateloadtestresource-encryption
LoadTestResource resource = manager
.loadTests()
.getByResourceGroup("sample-rg", "sample-loadtesting-resource");

LoadTestResource resourcePostUpdate = resource
.update()
.withIdentity(
new ManagedServiceIdentity()
.withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)
)
.withEncryption(
new EncryptionProperties()
.withIdentity(
new EncryptionPropertiesIdentity()
.withResourceId(null)
.withType(Type.SYSTEM_ASSIGNED)
// make sure that system-assigned managed identity is enabled on the resource and the identity has been granted required permissions to access the key.
)
.withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde")
)
.apply();
```

Update an Azure Load Testing resource to update user-assigned managed identities.

```java readme-sample-updateloadtestresource-mi
Map<String, UserAssignedIdentity> map = new HashMap<String, UserAssignedIdentity>();
// Note: the value of <identity1> set to null, removes the previously assigned managed identity from the load test resource
map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", null);
map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity2", new UserAssignedIdentity());

LoadTestResource resource = manager
.loadTests()
.getByResourceGroup("sample-rg", "sample-loadtesting-resource");

LoadTestResource resourcePostUpdate = resource
.update()
.withIdentity(
new ManagedServiceIdentity()
.withType(ManagedServiceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(map)
)
.apply();
```

### Delete an Azure Load Testing resource

```java readme-sample-deleteloadtestresource
manager
.loadTests()
.deleteByResourceGroup("sample-rg", "sample-loadtesting-resource");
```

### Quota Operations

Get quota values for all quota buckets.

```java readme-sample-list-all-quota-buckets
PagedIterable<QuotaResource> resource = manager
.quotas()
.list("westus2");

for (QuotaResource quotaResource : resource) {
// use the quotaResource
System.out.println(quotaResource.limit());
}
```

Get quota values for a particular quota bucket.

```java readme-sample-get-quota-bucket
QuotaResource resource = manager
.quotas()
.get("westus2", "maxConcurrentTestRuns");
System.out.println(resource.limit());
```

Check quota availability.

```java readme-sample-check-quota-availability
QuotaResource resource = manager
.quotas()
.get("westus2", "maxConcurrentTestRuns");

QuotaBucketRequestPropertiesDimensions dimensions = new QuotaBucketRequestPropertiesDimensions()
.withLocation("westus2")
.withSubscriptionId(manager.serviceClient().getSubscriptionId());

QuotaBucketRequest request = new QuotaBucketRequest()
.withCurrentQuota(resource.limit())
.withCurrentUsage(resource.usage())
.withNewQuota(resource.limit())
.withDimensions(dimensions);

CheckQuotaAvailabilityResponse availability = manager
.quotas()
.checkAvailability("westus2", "maxConcurrentTestRuns", request);

System.out.println(availability.isAvailable());
```

[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md)


Expand Down
41 changes: 13 additions & 28 deletions sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ public final class LoadTestsCreateOrUpdateSamples {
### LoadTests_Delete

```java
import com.azure.core.util.Context;

/** Samples for LoadTests Delete. */
public final class LoadTestsDeleteSamples {
/*
Expand All @@ -97,16 +95,14 @@ public final class LoadTestsDeleteSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void loadTestsDelete(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.loadTests().delete("dummyrg", "myLoadTest", Context.NONE);
manager.loadTests().delete("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE);
}
}
```

### LoadTests_GetByResourceGroup

```java
import com.azure.core.util.Context;

/** Samples for LoadTests GetByResourceGroup. */
public final class LoadTestsGetByResourceGroupSamples {
/*
Expand All @@ -118,16 +114,14 @@ public final class LoadTestsGetByResourceGroupSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void loadTestsGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE);
manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE);
}
}
```

### LoadTests_List

```java
import com.azure.core.util.Context;

/** Samples for LoadTests List. */
public final class LoadTestsListSamples {
/*
Expand All @@ -139,16 +133,14 @@ public final class LoadTestsListSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void loadTestsListBySubscription(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.loadTests().list(Context.NONE);
manager.loadTests().list(com.azure.core.util.Context.NONE);
}
}
```

### LoadTests_ListByResourceGroup

```java
import com.azure.core.util.Context;

/** Samples for LoadTests ListByResourceGroup. */
public final class LoadTestsListByResourceGroupSamples {
/*
Expand All @@ -160,16 +152,14 @@ public final class LoadTestsListByResourceGroupSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void loadTestsListByResourceGroup(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.loadTests().listByResourceGroup("dummyrg", Context.NONE);
manager.loadTests().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE);
}
}
```

### LoadTests_ListOutboundNetworkDependenciesEndpoints

```java
import com.azure.core.util.Context;

/** Samples for LoadTests ListOutboundNetworkDependenciesEndpoints. */
public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples {
/*
Expand All @@ -184,15 +174,14 @@ public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples {
manager
.loadTests()
.listOutboundNetworkDependenciesEndpoints(
"default-azureloadtest-japaneast", "sampleloadtest", Context.NONE);
"default-azureloadtest-japaneast", "sampleloadtest", com.azure.core.util.Context.NONE);
}
}
```

### LoadTests_Update

```java
import com.azure.core.util.Context;
import com.azure.resourcemanager.loadtesting.models.EncryptionProperties;
import com.azure.resourcemanager.loadtesting.models.EncryptionPropertiesIdentity;
import com.azure.resourcemanager.loadtesting.models.LoadTestResource;
Expand All @@ -215,7 +204,10 @@ public final class LoadTestsUpdateSamples {
*/
public static void loadTestsUpdate(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
LoadTestResource resource =
manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE).getValue();
manager
.loadTests()
.getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE)
.getValue();
resource
.update()
.withTags(mapOf("Division", "LT", "Team", "Dev Exp"))
Expand Down Expand Up @@ -250,8 +242,6 @@ public final class LoadTestsUpdateSamples {
### Operations_List

```java
import com.azure.core.util.Context;

/** Samples for Operations List. */
public final class OperationsListSamples {
/*
Expand All @@ -263,15 +253,14 @@ public final class OperationsListSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void operationsList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.operations().list(Context.NONE);
manager.operations().list(com.azure.core.util.Context.NONE);
}
}
```

### Quotas_CheckAvailability

```java
import com.azure.core.util.Context;
import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest;
import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions;

Expand Down Expand Up @@ -299,16 +288,14 @@ public final class QuotasCheckAvailabilitySamples {
new QuotaBucketRequestPropertiesDimensions()
.withSubscriptionId("testsubscriptionId")
.withLocation("westus")),
Context.NONE);
com.azure.core.util.Context.NONE);
}
}
```

### Quotas_Get

```java
import com.azure.core.util.Context;

/** Samples for Quotas Get. */
public final class QuotasGetSamples {
/*
Expand All @@ -320,16 +307,14 @@ public final class QuotasGetSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void quotasGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.quotas().getWithResponse("westus", "testQuotaBucket", Context.NONE);
manager.quotas().getWithResponse("westus", "testQuotaBucket", com.azure.core.util.Context.NONE);
}
}
```

### Quotas_List

```java
import com.azure.core.util.Context;

/** Samples for Quotas List. */
public final class QuotasListSamples {
/*
Expand All @@ -341,7 +326,7 @@ public final class QuotasListSamples {
* @param manager Entry point to LoadTestManager.
*/
public static void quotasList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) {
manager.quotas().list("westus", Context.NONE);
manager.quotas().list("westus", com.azure.core.util.Context.NONE);
}
}
```
Expand Down
Loading