selectors) {
this.selectors = selectors;
return this;
}
/**
- * Get the startOnCreation property: A boolean value that indicates if experiment should be started on creation or
- * not.
+ * Get the customerDataStorage property: Optional customer-managed Storage account where Experiment schema will be
+ * stored.
*
- * @return the startOnCreation value.
+ * @return the customerDataStorage value.
*/
- public Boolean startOnCreation() {
- return this.startOnCreation;
+ public CustomerDataStorageProperties customerDataStorage() {
+ return this.customerDataStorage;
}
/**
- * Set the startOnCreation property: A boolean value that indicates if experiment should be started on creation or
- * not.
+ * Set the customerDataStorage property: Optional customer-managed Storage account where Experiment schema will be
+ * stored.
*
- * @param startOnCreation the startOnCreation value to set.
+ * @param customerDataStorage the customerDataStorage value to set.
* @return the ExperimentProperties object itself.
*/
- public ExperimentProperties withStartOnCreation(Boolean startOnCreation) {
- this.startOnCreation = startOnCreation;
+ public ExperimentProperties withCustomerDataStorage(CustomerDataStorageProperties customerDataStorage) {
+ this.customerDataStorage = customerDataStorage;
return this;
}
@@ -118,6 +135,9 @@ public void validate() {
} else {
selectors().forEach(e -> e.validate());
}
+ if (customerDataStorage() != null) {
+ customerDataStorage().validate();
+ }
}
private static final ClientLogger LOGGER = new ClientLogger(ExperimentProperties.class);
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java
deleted file mode 100644
index 03dc806d31cd..000000000000
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.chaos.fluent.models;
-
-import com.azure.core.annotation.Immutable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/** Model that represents the result of a start Experiment operation. */
-@Immutable
-public final class ExperimentStartOperationResultInner {
- /*
- * String of the Experiment name.
- */
- @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
- private String name;
-
- /*
- * URL to retrieve the Experiment status.
- */
- @JsonProperty(value = "statusUrl", access = JsonProperty.Access.WRITE_ONLY)
- private String statusUrl;
-
- /** Creates an instance of ExperimentStartOperationResultInner class. */
- public ExperimentStartOperationResultInner() {
- }
-
- /**
- * Get the name property: String of the Experiment name.
- *
- * @return the name value.
- */
- public String name() {
- return this.name;
- }
-
- /**
- * Get the statusUrl property: URL to retrieve the Experiment status.
- *
- * @return the statusUrl value.
- */
- public String statusUrl() {
- return this.statusUrl;
- }
-
- /**
- * Validates the instance.
- *
- * @throws IllegalArgumentException thrown if the instance is not valid.
- */
- public void validate() {
- }
-}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java
new file mode 100644
index 000000000000..3468d9ffca75
--- /dev/null
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java
@@ -0,0 +1,187 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.chaos.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.management.exception.ManagementError;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The status of operation. */
+@Fluent
+public final class OperationStatusInner {
+ /*
+ * The operation Id.
+ */
+ @JsonProperty(value = "id")
+ private String id;
+
+ /*
+ * The operation name.
+ */
+ @JsonProperty(value = "name")
+ private String name;
+
+ /*
+ * The start time of the operation.
+ */
+ @JsonProperty(value = "startTime")
+ private String startTime;
+
+ /*
+ * The end time of the operation.
+ */
+ @JsonProperty(value = "endTime")
+ private String endTime;
+
+ /*
+ * The status of the operation.
+ */
+ @JsonProperty(value = "status")
+ private String status;
+
+ /*
+ * Error response
+ *
+ * The error detail of the operation if any.
+ */
+ @JsonProperty(value = "error")
+ private ManagementError error;
+
+ /** Creates an instance of OperationStatusInner class. */
+ public OperationStatusInner() {
+ }
+
+ /**
+ * Get the id property: The operation Id.
+ *
+ * @return the id value.
+ */
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * Set the id property: The operation Id.
+ *
+ * @param id the id value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withId(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Get the name property: The operation name.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Set the name property: The operation name.
+ *
+ * @param name the name value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Get the startTime property: The start time of the operation.
+ *
+ * @return the startTime value.
+ */
+ public String startTime() {
+ return this.startTime;
+ }
+
+ /**
+ * Set the startTime property: The start time of the operation.
+ *
+ * @param startTime the startTime value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withStartTime(String startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ /**
+ * Get the endTime property: The end time of the operation.
+ *
+ * @return the endTime value.
+ */
+ public String endTime() {
+ return this.endTime;
+ }
+
+ /**
+ * Set the endTime property: The end time of the operation.
+ *
+ * @param endTime the endTime value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withEndTime(String endTime) {
+ this.endTime = endTime;
+ return this;
+ }
+
+ /**
+ * Get the status property: The status of the operation.
+ *
+ * @return the status value.
+ */
+ public String status() {
+ return this.status;
+ }
+
+ /**
+ * Set the status property: The status of the operation.
+ *
+ * @param status the status value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withStatus(String status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * Get the error property: Error response
+ *
+ * The error detail of the operation if any.
+ *
+ * @return the error value.
+ */
+ public ManagementError error() {
+ return this.error;
+ }
+
+ /**
+ * Set the error property: Error response
+ *
+ *
The error detail of the operation if any.
+ *
+ * @param error the error value to set.
+ * @return the OperationStatusInner object itself.
+ */
+ public OperationStatusInner withError(ManagementError error) {
+ this.error = error;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java
index ed74ff20611a..866e2f6186ac 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java
@@ -137,7 +137,7 @@ public ChaosManagementClientImpl buildClient() {
localSerializerAdapter,
localDefaultPollInterval,
localEnvironment,
- subscriptionId,
+ this.subscriptionId,
localEndpoint);
return client;
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
index c07707c92a9d..f41b1ae866dc 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
@@ -26,6 +26,7 @@
import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient;
import com.azure.resourcemanager.chaos.fluent.ChaosManagementClient;
import com.azure.resourcemanager.chaos.fluent.ExperimentsClient;
+import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient;
import com.azure.resourcemanager.chaos.fluent.OperationsClient;
import com.azure.resourcemanager.chaos.fluent.TargetTypesClient;
import com.azure.resourcemanager.chaos.fluent.TargetsClient;
@@ -149,6 +150,18 @@ public ExperimentsClient getExperiments() {
return this.experiments;
}
+ /** The OperationStatusesClient object to access its operations. */
+ private final OperationStatusesClient operationStatuses;
+
+ /**
+ * Gets the OperationStatusesClient object to access its operations.
+ *
+ * @return the OperationStatusesClient object.
+ */
+ public OperationStatusesClient getOperationStatuses() {
+ return this.operationStatuses;
+ }
+
/** The OperationsClient object to access its operations. */
private final OperationsClient operations;
@@ -207,10 +220,11 @@ public TargetsClient getTargets() {
this.defaultPollInterval = defaultPollInterval;
this.subscriptionId = subscriptionId;
this.endpoint = endpoint;
- this.apiVersion = "2023-04-15-preview";
+ this.apiVersion = "2023-10-27-preview";
this.capabilities = new CapabilitiesClientImpl(this);
this.capabilityTypes = new CapabilityTypesClientImpl(this);
this.experiments = new ExperimentsClientImpl(this);
+ this.operationStatuses = new OperationStatusesClientImpl(this);
this.operations = new OperationsClientImpl(this);
this.targetTypes = new TargetTypesClientImpl(this);
this.targets = new TargetsClientImpl(this);
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java
deleted file mode 100644
index ab9f6c580516..000000000000
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.chaos.implementation;
-
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner;
-import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult;
-
-public final class ExperimentCancelOperationResultImpl implements ExperimentCancelOperationResult {
- private ExperimentCancelOperationResultInner innerObject;
-
- private final com.azure.resourcemanager.chaos.ChaosManager serviceManager;
-
- ExperimentCancelOperationResultImpl(
- ExperimentCancelOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) {
- this.innerObject = innerObject;
- this.serviceManager = serviceManager;
- }
-
- public String name() {
- return this.innerModel().name();
- }
-
- public String statusUrl() {
- return this.innerModel().statusUrl();
- }
-
- public ExperimentCancelOperationResultInner innerModel() {
- return this.innerObject;
- }
-
- private com.azure.resourcemanager.chaos.ChaosManager manager() {
- return this.serviceManager;
- }
-}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java
index d48f0bfa66a5..3fc9bf45d8ab 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java
@@ -4,18 +4,17 @@
package com.azure.resourcemanager.chaos.implementation;
-import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner;
+import com.azure.resourcemanager.chaos.models.ChaosExperimentStep;
+import com.azure.resourcemanager.chaos.models.ChaosTargetSelector;
+import com.azure.resourcemanager.chaos.models.CustomerDataStorageProperties;
import com.azure.resourcemanager.chaos.models.Experiment;
-import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult;
-import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult;
import com.azure.resourcemanager.chaos.models.ExperimentUpdate;
+import com.azure.resourcemanager.chaos.models.ProvisioningState;
import com.azure.resourcemanager.chaos.models.ResourceIdentity;
-import com.azure.resourcemanager.chaos.models.Selector;
-import com.azure.resourcemanager.chaos.models.Step;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -58,8 +57,12 @@ public ResourceIdentity identity() {
return this.innerModel().identity();
}
- public List steps() {
- List inner = this.innerModel().steps();
+ public ProvisioningState provisioningState() {
+ return this.innerModel().provisioningState();
+ }
+
+ public List steps() {
+ List inner = this.innerModel().steps();
if (inner != null) {
return Collections.unmodifiableList(inner);
} else {
@@ -67,8 +70,8 @@ public List steps() {
}
}
- public List selectors() {
- List inner = this.innerModel().selectors();
+ public List selectors() {
+ List inner = this.innerModel().selectors();
if (inner != null) {
return Collections.unmodifiableList(inner);
} else {
@@ -76,8 +79,8 @@ public List selectors() {
}
}
- public Boolean startOnCreation() {
- return this.innerModel().startOnCreation();
+ public CustomerDataStorageProperties customerDataStorage() {
+ return this.innerModel().customerDataStorage();
}
public Region region() {
@@ -116,8 +119,7 @@ public Experiment create() {
serviceManager
.serviceClient()
.getExperiments()
- .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), Context.NONE)
- .getValue();
+ .createOrUpdate(resourceGroupName, experimentName, this.innerModel(), Context.NONE);
return this;
}
@@ -126,8 +128,7 @@ public Experiment create(Context context) {
serviceManager
.serviceClient()
.getExperiments()
- .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), context)
- .getValue();
+ .createOrUpdate(resourceGroupName, experimentName, this.innerModel(), context);
return this;
}
@@ -147,8 +148,7 @@ public Experiment apply() {
serviceManager
.serviceClient()
.getExperiments()
- .updateWithResponse(resourceGroupName, experimentName, updateExperiment, Context.NONE)
- .getValue();
+ .update(resourceGroupName, experimentName, updateExperiment, Context.NONE);
return this;
}
@@ -157,8 +157,7 @@ public Experiment apply(Context context) {
serviceManager
.serviceClient()
.getExperiments()
- .updateWithResponse(resourceGroupName, experimentName, updateExperiment, context)
- .getValue();
+ .update(resourceGroupName, experimentName, updateExperiment, context);
return this;
}
@@ -189,20 +188,20 @@ public Experiment refresh(Context context) {
return this;
}
- public Response cancelWithResponse(Context context) {
- return serviceManager.experiments().cancelWithResponse(resourceGroupName, experimentName, context);
+ public void cancel() {
+ serviceManager.experiments().cancel(resourceGroupName, experimentName);
}
- public ExperimentCancelOperationResult cancel() {
- return serviceManager.experiments().cancel(resourceGroupName, experimentName);
+ public void cancel(Context context) {
+ serviceManager.experiments().cancel(resourceGroupName, experimentName, context);
}
- public Response startWithResponse(Context context) {
- return serviceManager.experiments().startWithResponse(resourceGroupName, experimentName, context);
+ public void start() {
+ serviceManager.experiments().start(resourceGroupName, experimentName);
}
- public ExperimentStartOperationResult start() {
- return serviceManager.experiments().start(resourceGroupName, experimentName);
+ public void start(Context context) {
+ serviceManager.experiments().start(resourceGroupName, experimentName, context);
}
public ExperimentImpl withRegion(Region location) {
@@ -215,12 +214,12 @@ public ExperimentImpl withRegion(String location) {
return this;
}
- public ExperimentImpl withSteps(List steps) {
+ public ExperimentImpl withSteps(List steps) {
this.innerModel().withSteps(steps);
return this;
}
- public ExperimentImpl withSelectors(List selectors) {
+ public ExperimentImpl withSelectors(List selectors) {
this.innerModel().withSelectors(selectors);
return this;
}
@@ -240,8 +239,8 @@ public ExperimentImpl withIdentity(ResourceIdentity identity) {
}
}
- public ExperimentImpl withStartOnCreation(Boolean startOnCreation) {
- this.innerModel().withStartOnCreation(startOnCreation);
+ public ExperimentImpl withCustomerDataStorage(CustomerDataStorageProperties customerDataStorage) {
+ this.innerModel().withCustomerDataStorage(customerDataStorage);
return this;
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java
deleted file mode 100644
index 8fa3ca1fcc2c..000000000000
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.chaos.implementation;
-
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner;
-import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult;
-
-public final class ExperimentStartOperationResultImpl implements ExperimentStartOperationResult {
- private ExperimentStartOperationResultInner innerObject;
-
- private final com.azure.resourcemanager.chaos.ChaosManager serviceManager;
-
- ExperimentStartOperationResultImpl(
- ExperimentStartOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) {
- this.innerObject = innerObject;
- this.serviceManager = serviceManager;
- }
-
- public String name() {
- return this.innerModel().name();
- }
-
- public String statusUrl() {
- return this.innerModel().statusUrl();
- }
-
- public ExperimentStartOperationResultInner innerModel() {
- return this.innerObject;
- }
-
- private com.azure.resourcemanager.chaos.ChaosManager manager() {
- return this.serviceManager;
- }
-}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
index dcf3d6a39bc9..1c5bfd94855a 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
@@ -28,18 +28,21 @@
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.chaos.fluent.ExperimentsClient;
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner;
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner;
import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsListResult;
import com.azure.resourcemanager.chaos.models.ExperimentListResult;
import com.azure.resourcemanager.chaos.models.ExperimentStatusListResult;
import com.azure.resourcemanager.chaos.models.ExperimentUpdate;
+import java.nio.ByteBuffer;
+import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in ExperimentsClient. */
@@ -98,9 +101,9 @@ Mono> listByResourceGroup(
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}")
- @ExpectedResponses({200, 204})
+ @ExpectedResponses({202})
@UnexpectedResponseExceptionType(ManagementException.class)
- Mono> delete(
+ Mono>> delete(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@@ -126,9 +129,9 @@ Mono> getByResourceGroup(
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}")
- @ExpectedResponses({200})
+ @ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
- Mono> createOrUpdate(
+ Mono>> createOrUpdate(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@@ -141,9 +144,9 @@ Mono> createOrUpdate(
@Headers({"Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}")
- @ExpectedResponses({200})
+ @ExpectedResponses({202})
@UnexpectedResponseExceptionType(ManagementException.class)
- Mono> update(
+ Mono>> update(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@@ -158,7 +161,7 @@ Mono> update(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(ManagementException.class)
- Mono> cancel(
+ Mono>> cancel(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@@ -172,7 +175,7 @@ Mono> cancel(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(ManagementException.class)
- Mono> start(
+ Mono>> start(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@@ -682,7 +685,7 @@ public PagedIterable listByResourceGroup(
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> deleteWithResponseAsync(String resourceGroupName, String experimentName) {
+ private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
@@ -730,7 +733,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> deleteWithResponseAsync(
+ private Mono>> deleteWithResponseAsync(
String resourceGroupName, String experimentName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -764,6 +767,78 @@ private Mono> deleteWithResponseAsync(
context);
}
+ /**
+ * Delete a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String experimentName) {
+ Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
+ }
+
+ /**
+ * Delete a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginDeleteAsync(
+ String resourceGroupName, String experimentName, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName, context);
+ return this
+ .client
+ .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
+ }
+
+ /**
+ * Delete a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName) {
+ return this.beginDeleteAsync(resourceGroupName, experimentName).getSyncPoller();
+ }
+
+ /**
+ * Delete a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginDelete(
+ String resourceGroupName, String experimentName, Context context) {
+ return this.beginDeleteAsync(resourceGroupName, experimentName, context).getSyncPoller();
+ }
+
/**
* Delete a Experiment resource.
*
@@ -776,7 +851,9 @@ private Mono> deleteWithResponseAsync(
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String experimentName) {
- return deleteWithResponseAsync(resourceGroupName, experimentName).flatMap(ignored -> Mono.empty());
+ return beginDeleteAsync(resourceGroupName, experimentName)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -788,11 +865,13 @@ private Mono deleteAsync(String resourceGroupName, String experimentName)
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return the {@link Response}.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response deleteWithResponse(String resourceGroupName, String experimentName, Context context) {
- return deleteWithResponseAsync(resourceGroupName, experimentName, context).block();
+ private Mono deleteAsync(String resourceGroupName, String experimentName, Context context) {
+ return beginDeleteAsync(resourceGroupName, experimentName, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -806,7 +885,22 @@ public Response deleteWithResponse(String resourceGroupName, String experi
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String experimentName) {
- deleteWithResponse(resourceGroupName, experimentName, Context.NONE);
+ deleteAsync(resourceGroupName, experimentName).block();
+ }
+
+ /**
+ * Delete a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void delete(String resourceGroupName, String experimentName, Context context) {
+ deleteAsync(resourceGroupName, experimentName, context).block();
}
/**
@@ -964,7 +1058,7 @@ public ExperimentInner getByResourceGroup(String resourceGroupName, String exper
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> createOrUpdateWithResponseAsync(
+ private Mono>> createOrUpdateWithResponseAsync(
String resourceGroupName, String experimentName, ExperimentInner experiment) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1021,7 +1115,7 @@ private Mono> createOrUpdateWithResponseAsync(
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> createOrUpdateWithResponseAsync(
+ private Mono>> createOrUpdateWithResponseAsync(
String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1061,6 +1155,91 @@ private Mono> createOrUpdateWithResponseAsync(
context);
}
+ /**
+ * Create or update a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Experiment resource to be created or updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync(
+ String resourceGroupName, String experimentName, ExperimentInner experiment) {
+ Mono>> mono =
+ createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment);
+ return this
+ .client
+ .getLroResult(
+ mono,
+ this.client.getHttpPipeline(),
+ ExperimentInner.class,
+ ExperimentInner.class,
+ this.client.getContext());
+ }
+
+ /**
+ * Create or update a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Experiment resource to be created or updated.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync(
+ String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono =
+ createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context);
+ }
+
+ /**
+ * Create or update a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Experiment resource to be created or updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ExperimentInner> beginCreateOrUpdate(
+ String resourceGroupName, String experimentName, ExperimentInner experiment) {
+ return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller();
+ }
+
+ /**
+ * Create or update a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Experiment resource to be created or updated.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ExperimentInner> beginCreateOrUpdate(
+ String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) {
+ return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller();
+ }
+
/**
* Create or update a Experiment resource.
*
@@ -1075,8 +1254,9 @@ private Mono> createOrUpdateWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(
String resourceGroupName, String experimentName, ExperimentInner experiment) {
- return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment)
- .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1089,12 +1269,14 @@ private Mono createOrUpdateAsync(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents a Experiment resource along with {@link Response}.
+ * @return model that represents a Experiment resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response createOrUpdateWithResponse(
+ private Mono createOrUpdateAsync(
String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) {
- return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block();
+ return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1110,7 +1292,25 @@ public Response createOrUpdateWithResponse(
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment) {
- return createOrUpdateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue();
+ return createOrUpdateAsync(resourceGroupName, experimentName, experiment).block();
+ }
+
+ /**
+ * Create or update a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Experiment resource to be created or updated.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ExperimentInner createOrUpdate(
+ String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) {
+ return createOrUpdateAsync(resourceGroupName, experimentName, experiment, context).block();
}
/**
@@ -1126,7 +1326,7 @@ public ExperimentInner createOrUpdate(String resourceGroupName, String experimen
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> updateWithResponseAsync(
+ private Mono>> updateWithResponseAsync(
String resourceGroupName, String experimentName, ExperimentUpdate experiment) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1183,7 +1383,7 @@ private Mono> updateWithResponseAsync(
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> updateWithResponseAsync(
+ private Mono>> updateWithResponseAsync(
String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1223,6 +1423,90 @@ private Mono> updateWithResponseAsync(
context);
}
+ /**
+ * The operation to update an experiment.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Parameters supplied to the Update experiment operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ExperimentInner> beginUpdateAsync(
+ String resourceGroupName, String experimentName, ExperimentUpdate experiment) {
+ Mono>> mono = updateWithResponseAsync(resourceGroupName, experimentName, experiment);
+ return this
+ .client
+ .getLroResult(
+ mono,
+ this.client.getHttpPipeline(),
+ ExperimentInner.class,
+ ExperimentInner.class,
+ this.client.getContext());
+ }
+
+ /**
+ * The operation to update an experiment.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Parameters supplied to the Update experiment operation.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ExperimentInner> beginUpdateAsync(
+ String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono =
+ updateWithResponseAsync(resourceGroupName, experimentName, experiment, context);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context);
+ }
+
+ /**
+ * The operation to update an experiment.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Parameters supplied to the Update experiment operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ExperimentInner> beginUpdate(
+ String resourceGroupName, String experimentName, ExperimentUpdate experiment) {
+ return this.beginUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller();
+ }
+
+ /**
+ * The operation to update an experiment.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Parameters supplied to the Update experiment operation.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ExperimentInner> beginUpdate(
+ String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) {
+ return this.beginUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller();
+ }
+
/**
* The operation to update an experiment.
*
@@ -1237,8 +1521,9 @@ private Mono> updateWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(
String resourceGroupName, String experimentName, ExperimentUpdate experiment) {
- return updateWithResponseAsync(resourceGroupName, experimentName, experiment)
- .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ return beginUpdateAsync(resourceGroupName, experimentName, experiment)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1251,12 +1536,14 @@ private Mono updateAsync(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents a Experiment resource along with {@link Response}.
+ * @return model that represents a Experiment resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response updateWithResponse(
+ private Mono updateAsync(
String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) {
- return updateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block();
+ return beginUpdateAsync(resourceGroupName, experimentName, experiment, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1272,7 +1559,25 @@ public Response updateWithResponse(
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment) {
- return updateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue();
+ return updateAsync(resourceGroupName, experimentName, experiment).block();
+ }
+
+ /**
+ * The operation to update an experiment.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param experiment Parameters supplied to the Update experiment operation.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return model that represents a Experiment resource.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ExperimentInner update(
+ String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) {
+ return updateAsync(resourceGroupName, experimentName, experiment, context).block();
}
/**
@@ -1283,12 +1588,10 @@ public ExperimentInner update(String resourceGroupName, String experimentName, E
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a cancel Experiment operation along with {@link Response} on
- * successful completion of {@link Mono}.
+ * @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> cancelWithResponseAsync(
- String resourceGroupName, String experimentName) {
+ private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
@@ -1333,11 +1636,10 @@ private Mono> cancelWithResponseA
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a cancel Experiment operation along with {@link Response} on
- * successful completion of {@link Mono}.
+ * @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> cancelWithResponseAsync(
+ private Mono>> cancelWithResponseAsync(
String resourceGroupName, String experimentName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1379,13 +1681,85 @@ private Mono> cancelWithResponseA
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a cancel Experiment operation on successful completion of {@link
- * Mono}.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String experimentName) {
+ Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
+ }
+
+ /**
+ * Cancel a running Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginCancelAsync(
+ String resourceGroupName, String experimentName, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName, context);
+ return this
+ .client
+ .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
+ }
+
+ /**
+ * Cancel a running Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName) {
+ return this.beginCancelAsync(resourceGroupName, experimentName).getSyncPoller();
+ }
+
+ /**
+ * Cancel a running Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginCancel(
+ String resourceGroupName, String experimentName, Context context) {
+ return this.beginCancelAsync(resourceGroupName, experimentName, context).getSyncPoller();
+ }
+
+ /**
+ * Cancel a running Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono cancelAsync(String resourceGroupName, String experimentName) {
- return cancelWithResponseAsync(resourceGroupName, experimentName)
- .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ private Mono cancelAsync(String resourceGroupName, String experimentName) {
+ return beginCancelAsync(resourceGroupName, experimentName)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1397,12 +1771,27 @@ private Mono cancelAsync(String resourceGr
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a cancel Experiment operation along with {@link Response}.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response cancelWithResponse(
- String resourceGroupName, String experimentName, Context context) {
- return cancelWithResponseAsync(resourceGroupName, experimentName, context).block();
+ private Mono cancelAsync(String resourceGroupName, String experimentName, Context context) {
+ return beginCancelAsync(resourceGroupName, experimentName, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Cancel a running Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void cancel(String resourceGroupName, String experimentName) {
+ cancelAsync(resourceGroupName, experimentName).block();
}
/**
@@ -1410,14 +1799,14 @@ public Response cancelWithResponse(
*
* @param resourceGroupName String that represents an Azure resource group.
* @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a cancel Experiment operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName) {
- return cancelWithResponse(resourceGroupName, experimentName, Context.NONE).getValue();
+ public void cancel(String resourceGroupName, String experimentName, Context context) {
+ cancelAsync(resourceGroupName, experimentName, context).block();
}
/**
@@ -1428,12 +1817,10 @@ public ExperimentCancelOperationResultInner cancel(String resourceGroupName, Str
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a start Experiment operation along with {@link Response} on
- * successful completion of {@link Mono}.
+ * @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> startWithResponseAsync(
- String resourceGroupName, String experimentName) {
+ private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
@@ -1478,11 +1865,10 @@ private Mono> startWithResponseAsy
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a start Experiment operation along with {@link Response} on
- * successful completion of {@link Mono}.
+ * @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> startWithResponseAsync(
+ private Mono>> startWithResponseAsync(
String resourceGroupName, String experimentName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
@@ -1524,13 +1910,83 @@ private Mono> startWithResponseAsy
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a start Experiment operation on successful completion of {@link
- * Mono}.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginStartAsync(String resourceGroupName, String experimentName) {
+ Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
+ }
+
+ /**
+ * Start a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginStartAsync(
+ String resourceGroupName, String experimentName, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName, context);
+ return this
+ .client
+ .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
+ }
+
+ /**
+ * Start a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginStart(String resourceGroupName, String experimentName) {
+ return this.beginStartAsync(resourceGroupName, experimentName).getSyncPoller();
+ }
+
+ /**
+ * Start a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginStart(
+ String resourceGroupName, String experimentName, Context context) {
+ return this.beginStartAsync(resourceGroupName, experimentName, context).getSyncPoller();
+ }
+
+ /**
+ * Start a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono startAsync(String resourceGroupName, String experimentName) {
- return startWithResponseAsync(resourceGroupName, experimentName)
- .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ private Mono startAsync(String resourceGroupName, String experimentName) {
+ return beginStartAsync(resourceGroupName, experimentName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
@@ -1542,12 +1998,27 @@ private Mono startAsync(String resourceGrou
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a start Experiment operation along with {@link Response}.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response startWithResponse(
- String resourceGroupName, String experimentName, Context context) {
- return startWithResponseAsync(resourceGroupName, experimentName, context).block();
+ private Mono startAsync(String resourceGroupName, String experimentName, Context context) {
+ return beginStartAsync(resourceGroupName, experimentName, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Start a Experiment resource.
+ *
+ * @param resourceGroupName String that represents an Azure resource group.
+ * @param experimentName String that represents a Experiment resource name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void start(String resourceGroupName, String experimentName) {
+ startAsync(resourceGroupName, experimentName).block();
}
/**
@@ -1555,14 +2026,14 @@ public Response startWithResponse(
*
* @param resourceGroupName String that represents an Azure resource group.
* @param experimentName String that represents a Experiment resource name.
+ * @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return model that represents the result of a start Experiment operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName) {
- return startWithResponse(resourceGroupName, experimentName, Context.NONE).getValue();
+ public void start(String resourceGroupName, String experimentName, Context context) {
+ startAsync(resourceGroupName, experimentName, context).block();
}
/**
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java
index 66d80202a470..b81ad91e4bbe 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java
@@ -10,15 +10,11 @@
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.chaos.fluent.ExperimentsClient;
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner;
-import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner;
import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner;
import com.azure.resourcemanager.chaos.models.Experiment;
-import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult;
import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails;
-import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult;
import com.azure.resourcemanager.chaos.models.ExperimentStatus;
import com.azure.resourcemanager.chaos.models.Experiments;
@@ -56,15 +52,14 @@ public PagedIterable listByResourceGroup(
return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager()));
}
- public Response deleteByResourceGroupWithResponse(
- String resourceGroupName, String experimentName, Context context) {
- return this.serviceClient().deleteWithResponse(resourceGroupName, experimentName, context);
- }
-
public void deleteByResourceGroup(String resourceGroupName, String experimentName) {
this.serviceClient().delete(resourceGroupName, experimentName);
}
+ public void delete(String resourceGroupName, String experimentName, Context context) {
+ this.serviceClient().delete(resourceGroupName, experimentName, context);
+ }
+
public Response getByResourceGroupWithResponse(
String resourceGroupName, String experimentName, Context context) {
Response inner =
@@ -89,52 +84,20 @@ public Experiment getByResourceGroup(String resourceGroupName, String experiment
}
}
- public Response cancelWithResponse(
- String resourceGroupName, String experimentName, Context context) {
- Response inner =
- this.serviceClient().cancelWithResponse(resourceGroupName, experimentName, context);
- if (inner != null) {
- return new SimpleResponse<>(
- inner.getRequest(),
- inner.getStatusCode(),
- inner.getHeaders(),
- new ExperimentCancelOperationResultImpl(inner.getValue(), this.manager()));
- } else {
- return null;
- }
+ public void cancel(String resourceGroupName, String experimentName) {
+ this.serviceClient().cancel(resourceGroupName, experimentName);
}
- public ExperimentCancelOperationResult cancel(String resourceGroupName, String experimentName) {
- ExperimentCancelOperationResultInner inner = this.serviceClient().cancel(resourceGroupName, experimentName);
- if (inner != null) {
- return new ExperimentCancelOperationResultImpl(inner, this.manager());
- } else {
- return null;
- }
+ public void cancel(String resourceGroupName, String experimentName, Context context) {
+ this.serviceClient().cancel(resourceGroupName, experimentName, context);
}
- public Response startWithResponse(
- String resourceGroupName, String experimentName, Context context) {
- Response inner =
- this.serviceClient().startWithResponse(resourceGroupName, experimentName, context);
- if (inner != null) {
- return new SimpleResponse<>(
- inner.getRequest(),
- inner.getStatusCode(),
- inner.getHeaders(),
- new ExperimentStartOperationResultImpl(inner.getValue(), this.manager()));
- } else {
- return null;
- }
+ public void start(String resourceGroupName, String experimentName) {
+ this.serviceClient().start(resourceGroupName, experimentName);
}
- public ExperimentStartOperationResult start(String resourceGroupName, String experimentName) {
- ExperimentStartOperationResultInner inner = this.serviceClient().start(resourceGroupName, experimentName);
- if (inner != null) {
- return new ExperimentStartOperationResultImpl(inner, this.manager());
- } else {
- return null;
- }
+ public void start(String resourceGroupName, String experimentName, Context context) {
+ this.serviceClient().start(resourceGroupName, experimentName, context);
}
public PagedIterable listAllStatuses(String resourceGroupName, String experimentName) {
@@ -270,10 +233,10 @@ public void deleteById(String id) {
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id)));
}
- this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE);
+ this.delete(resourceGroupName, experimentName, Context.NONE);
}
- public Response deleteByIdWithResponse(String id, Context context) {
+ public void deleteByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER
@@ -289,7 +252,7 @@ public Response deleteByIdWithResponse(String id, Context context) {
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id)));
}
- return this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, context);
+ this.delete(resourceGroupName, experimentName, context);
}
private ExperimentsClient serviceClient() {
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java
new file mode 100644
index 000000000000..09adcaaa1102
--- /dev/null
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.chaos.implementation;
+
+import com.azure.core.management.exception.ManagementError;
+import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
+import com.azure.resourcemanager.chaos.models.OperationStatus;
+
+public final class OperationStatusImpl implements OperationStatus {
+ private OperationStatusInner innerObject;
+
+ private final com.azure.resourcemanager.chaos.ChaosManager serviceManager;
+
+ OperationStatusImpl(OperationStatusInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String startTime() {
+ return this.innerModel().startTime();
+ }
+
+ public String endTime() {
+ return this.innerModel().endTime();
+ }
+
+ public String status() {
+ return this.innerModel().status();
+ }
+
+ public ManagementError error() {
+ return this.innerModel().error();
+ }
+
+ public OperationStatusInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.chaos.ChaosManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java
new file mode 100644
index 000000000000..9fd0d252fbaa
--- /dev/null
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java
@@ -0,0 +1,209 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.chaos.implementation;
+
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient;
+import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */
+public final class OperationStatusesClientImpl implements OperationStatusesClient {
+ /** The proxy service used to perform REST calls. */
+ private final OperationStatusesService service;
+
+ /** The service client containing this operation class. */
+ private final ChaosManagementClientImpl client;
+
+ /**
+ * Initializes an instance of OperationStatusesClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ OperationStatusesClientImpl(ChaosManagementClientImpl client) {
+ this.service =
+ RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ChaosManagementClientOperationStatuses to be used by the proxy
+ * service to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ChaosManagementClien")
+ public interface OperationStatusesService {
+ @Headers({"Content-Type: application/json"})
+ @Get(
+ "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationsStatuses/{asyncOperationId}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> get(
+ @HostParam("$host") String endpoint,
+ @PathParam("location") String location,
+ @PathParam("asyncOperationId") String asyncOperationId,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("subscriptionId") String subscriptionId,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * Get the status of a long running azure asynchronous operation.
+ *
+ * @param location The region name of operation.
+ * @param asyncOperationId The operation Id.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a long running azure asynchronous operation along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(String location, String asyncOperationId) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (location == null) {
+ return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
+ }
+ if (asyncOperationId == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null."));
+ }
+ if (this.client.getSubscriptionId() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getSubscriptionId() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .get(
+ this.client.getEndpoint(),
+ location,
+ asyncOperationId,
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the status of a long running azure asynchronous operation.
+ *
+ * @param location The region name of operation.
+ * @param asyncOperationId The operation Id.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a long running azure asynchronous operation along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(
+ String location, String asyncOperationId, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (location == null) {
+ return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
+ }
+ if (asyncOperationId == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null."));
+ }
+ if (this.client.getSubscriptionId() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getSubscriptionId() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .get(
+ this.client.getEndpoint(),
+ location,
+ asyncOperationId,
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ accept,
+ context);
+ }
+
+ /**
+ * Get the status of a long running azure asynchronous operation.
+ *
+ * @param location The region name of operation.
+ * @param asyncOperationId The operation Id.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a long running azure asynchronous operation on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String location, String asyncOperationId) {
+ return getWithResponseAsync(location, asyncOperationId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get the status of a long running azure asynchronous operation.
+ *
+ * @param location The region name of operation.
+ * @param asyncOperationId The operation Id.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a long running azure asynchronous operation along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String location, String asyncOperationId, Context context) {
+ return getWithResponseAsync(location, asyncOperationId, context).block();
+ }
+
+ /**
+ * Get the status of a long running azure asynchronous operation.
+ *
+ * @param location The region name of operation.
+ * @param asyncOperationId The operation Id.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the status of a long running azure asynchronous operation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public OperationStatusInner get(String location, String asyncOperationId) {
+ return getWithResponse(location, asyncOperationId, Context.NONE).getValue();
+ }
+}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java
new file mode 100644
index 000000000000..8ae63088b7b0
--- /dev/null
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java
@@ -0,0 +1,59 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.chaos.implementation;
+
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.SimpleResponse;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient;
+import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
+import com.azure.resourcemanager.chaos.models.OperationStatus;
+import com.azure.resourcemanager.chaos.models.OperationStatuses;
+
+public final class OperationStatusesImpl implements OperationStatuses {
+ private static final ClientLogger LOGGER = new ClientLogger(OperationStatusesImpl.class);
+
+ private final OperationStatusesClient innerClient;
+
+ private final com.azure.resourcemanager.chaos.ChaosManager serviceManager;
+
+ public OperationStatusesImpl(
+ OperationStatusesClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public Response getWithResponse(String location, String asyncOperationId, Context context) {
+ Response inner =
+ this.serviceClient().getWithResponse(location, asyncOperationId, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new OperationStatusImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public OperationStatus get(String location, String asyncOperationId) {
+ OperationStatusInner inner = this.serviceClient().get(location, asyncOperationId);
+ if (inner != null) {
+ return new OperationStatusImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ private OperationStatusesClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.chaos.ChaosManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java
index a5c97173501e..2ea1ef1f8be7 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java
@@ -20,6 +20,9 @@
import reactor.core.publisher.Flux;
final class Utils {
+ private Utils() {
+ }
+
static String getValueFromIdByName(String id, String name) {
if (id == null) {
return null;
@@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
segments.add(idSegment);
idItrReverted.forEachRemaining(segments::add);
Collections.reverse(segments);
- if (segments.size() > 0 && segments.get(0).isEmpty()) {
+ if (!segments.isEmpty() && segments.get(0).isEmpty()) {
segments.remove(0);
}
return String.join("/", segments);
@@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}
static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) {
- return new PagedIterableImpl(pageIterable, mapper);
+ return new PagedIterableImpl<>(pageIterable, mapper);
}
private static final class PagedIterableImpl extends PagedIterable {
@@ -133,30 +136,27 @@ public Stream> streamByPage(String continuationToken, int prefe
@Override
public Iterator iterator() {
- return new IteratorImpl(pagedIterable.iterator(), mapper);
+ return new IteratorImpl<>(pagedIterable.iterator(), mapper);
}
@Override
public Iterable> iterableByPage() {
- return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper);
+ return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper);
}
@Override
public Iterable> iterableByPage(String continuationToken) {
- return new IterableImpl, PagedResponse>(
- pagedIterable.iterableByPage(continuationToken), pageMapper);
+ return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper);
}
@Override
public Iterable> iterableByPage(int preferredPageSize) {
- return new IterableImpl, PagedResponse>(
- pagedIterable.iterableByPage(preferredPageSize), pageMapper);
+ return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper);
}
@Override
public Iterable> iterableByPage(String continuationToken, int preferredPageSize) {
- return new IterableImpl, PagedResponse>(
- pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
+ return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
}
}
@@ -198,7 +198,7 @@ private IterableImpl(Iterable iterable, Function mapper) {
@Override
public Iterator iterator() {
- return new IteratorImpl(iterable.iterator(), mapper);
+ return new IteratorImpl<>(iterable.iterator(), mapper);
}
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
similarity index 76%
rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java
rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
index b66cd0a8ffc2..5c2a51835a73 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
@@ -16,23 +16,23 @@
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type",
- defaultImpl = Action.class)
-@JsonTypeName("Action")
+ defaultImpl = ChaosExperimentAction.class)
+@JsonTypeName("ChaosExperimentAction")
@JsonSubTypes({
@JsonSubTypes.Type(name = "delay", value = DelayAction.class),
@JsonSubTypes.Type(name = "discrete", value = DiscreteAction.class),
@JsonSubTypes.Type(name = "continuous", value = ContinuousAction.class)
})
@Fluent
-public class Action {
+public class ChaosExperimentAction {
/*
* String that represents a Capability URN.
*/
@JsonProperty(value = "name", required = true)
private String name;
- /** Creates an instance of Action class. */
- public Action() {
+ /** Creates an instance of ChaosExperimentAction class. */
+ public ChaosExperimentAction() {
}
/**
@@ -48,9 +48,9 @@ public String name() {
* Set the name property: String that represents a Capability URN.
*
* @param name the name value to set.
- * @return the Action object itself.
+ * @return the ChaosExperimentAction object itself.
*/
- public Action withName(String name) {
+ public ChaosExperimentAction withName(String name) {
this.name = name;
return this;
}
@@ -63,9 +63,10 @@ public Action withName(String name) {
public void validate() {
if (name() == null) {
throw LOGGER
- .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Action"));
+ .logExceptionAsError(
+ new IllegalArgumentException("Missing required property name in model ChaosExperimentAction"));
}
}
- private static final ClientLogger LOGGER = new ClientLogger(Action.class);
+ private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentAction.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
similarity index 67%
rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java
rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
index 6cb88d39d96c..f2c7c9c6bc18 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
@@ -11,7 +11,7 @@
/** Model that represents a branch in the step. */
@Fluent
-public final class Branch {
+public final class ChaosExperimentBranch {
/*
* String of the branch name.
*/
@@ -22,10 +22,10 @@ public final class Branch {
* List of actions.
*/
@JsonProperty(value = "actions", required = true)
- private List actions;
+ private List actions;
- /** Creates an instance of Branch class. */
- public Branch() {
+ /** Creates an instance of ChaosExperimentBranch class. */
+ public ChaosExperimentBranch() {
}
/**
@@ -41,9 +41,9 @@ public String name() {
* Set the name property: String of the branch name.
*
* @param name the name value to set.
- * @return the Branch object itself.
+ * @return the ChaosExperimentBranch object itself.
*/
- public Branch withName(String name) {
+ public ChaosExperimentBranch withName(String name) {
this.name = name;
return this;
}
@@ -53,7 +53,7 @@ public Branch withName(String name) {
*
* @return the actions value.
*/
- public List actions() {
+ public List actions() {
return this.actions;
}
@@ -61,9 +61,9 @@ public List actions() {
* Set the actions property: List of actions.
*
* @param actions the actions value to set.
- * @return the Branch object itself.
+ * @return the ChaosExperimentBranch object itself.
*/
- public Branch withActions(List actions) {
+ public ChaosExperimentBranch withActions(List actions) {
this.actions = actions;
return this;
}
@@ -76,15 +76,17 @@ public Branch withActions(List actions) {
public void validate() {
if (name() == null) {
throw LOGGER
- .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Branch"));
+ .logExceptionAsError(
+ new IllegalArgumentException("Missing required property name in model ChaosExperimentBranch"));
}
if (actions() == null) {
throw LOGGER
- .logExceptionAsError(new IllegalArgumentException("Missing required property actions in model Branch"));
+ .logExceptionAsError(
+ new IllegalArgumentException("Missing required property actions in model ChaosExperimentBranch"));
} else {
actions().forEach(e -> e.validate());
}
}
- private static final ClientLogger LOGGER = new ClientLogger(Branch.class);
+ private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentBranch.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
similarity index 68%
rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java
rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
index a8e01d2246e0..f8b09bda8fc6 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
@@ -11,7 +11,7 @@
/** Model that represents a step in the Experiment resource. */
@Fluent
-public final class Step {
+public final class ChaosExperimentStep {
/*
* String of the step name.
*/
@@ -22,10 +22,10 @@ public final class Step {
* List of branches.
*/
@JsonProperty(value = "branches", required = true)
- private List branches;
+ private List branches;
- /** Creates an instance of Step class. */
- public Step() {
+ /** Creates an instance of ChaosExperimentStep class. */
+ public ChaosExperimentStep() {
}
/**
@@ -41,9 +41,9 @@ public String name() {
* Set the name property: String of the step name.
*
* @param name the name value to set.
- * @return the Step object itself.
+ * @return the ChaosExperimentStep object itself.
*/
- public Step withName(String name) {
+ public ChaosExperimentStep withName(String name) {
this.name = name;
return this;
}
@@ -53,7 +53,7 @@ public Step withName(String name) {
*
* @return the branches value.
*/
- public List branches() {
+ public List branches() {
return this.branches;
}
@@ -61,9 +61,9 @@ public List branches() {
* Set the branches property: List of branches.
*
* @param branches the branches value to set.
- * @return the Step object itself.
+ * @return the ChaosExperimentStep object itself.
*/
- public Step withBranches(List branches) {
+ public ChaosExperimentStep withBranches(List