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

[azure-developer-loadtesting] Updated SDK for API Version 2024-05-01-preview #43648

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.developer.loadtesting;

import com.azure.core.annotation.Generated;
Expand Down Expand Up @@ -33,7 +33,7 @@
import com.azure.core.util.builder.ClientBuilderUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl;
import com.azure.developer.loadtesting.implementation.LoadTestAdministrationClientImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -246,17 +246,17 @@ public LoadTestAdministrationClientBuilder retryPolicy(RetryPolicy retryPolicy)
}

/**
* Builds an instance of LoadTestingClientImpl with the provided parameters.
* Builds an instance of LoadTestAdministrationClientImpl with the provided parameters.
*
* @return an instance of LoadTestingClientImpl.
* @return an instance of LoadTestAdministrationClientImpl.
*/
@Generated
private LoadTestingClientImpl buildInnerClient() {
private LoadTestAdministrationClientImpl buildInnerClient() {
this.validateClient();
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
LoadTestingServiceVersion localServiceVersion
= (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest();
LoadTestingClientImpl client = new LoadTestingClientImpl(localPipeline,
LoadTestAdministrationClientImpl client = new LoadTestAdministrationClientImpl(localPipeline,
JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion);
return client;
}
Expand Down Expand Up @@ -306,7 +306,7 @@ private HttpPipeline createHttpPipeline() {
*/
@Generated
public LoadTestAdministrationAsyncClient buildAsyncClient() {
return new LoadTestAdministrationAsyncClient(buildInnerClient().getLoadTestAdministrations());
return new LoadTestAdministrationAsyncClient(buildInnerClient());
}

/**
Expand All @@ -316,7 +316,7 @@ public LoadTestAdministrationAsyncClient buildAsyncClient() {
*/
@Generated
public LoadTestAdministrationClient buildClient() {
return new LoadTestAdministrationClient(buildInnerClient().getLoadTestAdministrations());
return new LoadTestAdministrationClient(new LoadTestAdministrationAsyncClient(buildInnerClient()));
}

@Generated
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.developer.loadtesting;

import com.azure.core.annotation.Generated;
Expand Down Expand Up @@ -33,7 +33,7 @@
import com.azure.core.util.builder.ClientBuilderUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.developer.loadtesting.implementation.LoadTestingClientImpl;
import com.azure.developer.loadtesting.implementation.LoadTestRunClientImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -246,17 +246,17 @@ public LoadTestRunClientBuilder retryPolicy(RetryPolicy retryPolicy) {
}

/**
* Builds an instance of LoadTestingClientImpl with the provided parameters.
* Builds an instance of LoadTestRunClientImpl with the provided parameters.
*
* @return an instance of LoadTestingClientImpl.
* @return an instance of LoadTestRunClientImpl.
*/
@Generated
private LoadTestingClientImpl buildInnerClient() {
private LoadTestRunClientImpl buildInnerClient() {
this.validateClient();
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
LoadTestingServiceVersion localServiceVersion
= (serviceVersion != null) ? serviceVersion : LoadTestingServiceVersion.getLatest();
LoadTestingClientImpl client = new LoadTestingClientImpl(localPipeline,
LoadTestRunClientImpl client = new LoadTestRunClientImpl(localPipeline,
JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion);
return client;
}
Expand Down Expand Up @@ -306,7 +306,7 @@ private HttpPipeline createHttpPipeline() {
*/
@Generated
public LoadTestRunAsyncClient buildAsyncClient() {
return new LoadTestRunAsyncClient(buildInnerClient().getLoadTestRuns());
return new LoadTestRunAsyncClient(buildInnerClient());
}

/**
Expand All @@ -316,7 +316,7 @@ public LoadTestRunAsyncClient buildAsyncClient() {
*/
@Generated
public LoadTestRunClient buildClient() {
return new LoadTestRunClient(buildInnerClient().getLoadTestRuns());
return new LoadTestRunClient(new LoadTestRunAsyncClient(buildInnerClient()));
}

@Generated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.developer.loadtesting;

import com.azure.core.util.ServiceVersion;

/**
* Service version of LoadTestingClient.
* Service version of Load TestingClient.
*/
public enum LoadTestingServiceVersion implements ServiceVersion {
/**
* Enum value 2022-11-01.
*/
V2022_11_01("2022-11-01");
V2022_11_01("2022-11-01"),

/**
* Enum value 2023-04-01-preview.
*/
V2023_04_01_PREVIEW("2023-04-01-preview"),

/**
* Enum value 2024-03-01-preview.
*/
V2024_03_01_PREVIEW("2024-03-01-preview"),

/**
* Enum value 2024-05-01-preview.
*/
V2024_05_01_PREVIEW("2024-05-01-preview"),

/**
* Enum value 2024-07-01-preview.
*/
V2024_07_01_PREVIEW("2024-07-01-preview"),

/**
* Enum value 2024-12-01-preview.
*/
V2024_12_01_PREVIEW("2024-12-01-preview");

private final String version;

Expand All @@ -35,6 +60,6 @@ public String getVersion() {
* @return The latest {@link LoadTestingServiceVersion}.
*/
public static LoadTestingServiceVersion getLatest() {
return V2022_11_01;
return V2024_12_01_PREVIEW;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,47 @@ static PollResponse<BinaryData> getTestRunStatus(BinaryData testRunBinary) throw

return new PollResponse<>(lroStatus, testRunBinary);
}

static PollResponse<BinaryData> getTestProfileRunStatus(BinaryData testProfileRunBinary) throws RuntimeException {
String status;

try (JsonReader jsonReader = JsonProviders.createReader(testProfileRunBinary.toBytes())) {
Map<String, Object> jsonTree = jsonReader.readMap(JsonReader::readUntyped);

status = jsonTree.get("status").toString();
} catch (IOException e) {
throw new RuntimeException("Encountered exception while retrieving test profile run status", e);
}

LongRunningOperationStatus lroStatus;

switch (status) {
case "NOTSTARTED":
lroStatus = LongRunningOperationStatus.NOT_STARTED;

break;

case "DONE":
lroStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED;

break;

case "FAILED":
lroStatus = LongRunningOperationStatus.FAILED;

break;

case "CANCELLED":
lroStatus = LongRunningOperationStatus.USER_CANCELLED;

break;

default:
lroStatus = LongRunningOperationStatus.IN_PROGRESS;

break;
}

return new PollResponse<>(lroStatus, testProfileRunBinary);
}
}
Loading
Loading