diff --git a/services/logic/mgmt/2016-06-01/logic/logicapi/interfaces.go b/services/logic/mgmt/2016-06-01/logic/logicapi/interfaces.go index 8547270a5efd..e0d682effb9c 100644 --- a/services/logic/mgmt/2016-06-01/logic/logicapi/interfaces.go +++ b/services/logic/mgmt/2016-06-01/logic/logicapi/interfaces.go @@ -85,6 +85,7 @@ var _ WorkflowTriggerHistoriesClientAPI = (*logic.WorkflowTriggerHistoriesClient // WorkflowRunsClientAPI contains the set of methods on the WorkflowRunsClient type. type WorkflowRunsClientAPI interface { Cancel(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) + Delete(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result logic.WorkflowRun, err error) List(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result logic.WorkflowRunListResultPage, err error) } diff --git a/services/logic/mgmt/2016-06-01/logic/workflowruns.go b/services/logic/mgmt/2016-06-01/logic/workflowruns.go index 6ad6d47f5ac3..097a595da3d1 100644 --- a/services/logic/mgmt/2016-06-01/logic/workflowruns.go +++ b/services/logic/mgmt/2016-06-01/logic/workflowruns.go @@ -118,6 +118,84 @@ func (client WorkflowRunsClient) CancelResponder(resp *http.Response) (result au return } +// Delete deletes a workflow run. +// Parameters: +// resourceGroupName - the resource group name. +// workflowName - the workflow name. +// runName - the workflow run name. +func (client WorkflowRunsClient) Delete(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, workflowName, runName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkflowRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkflowRunsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets a workflow run. // Parameters: // resourceGroupName - the resource group name. diff --git a/services/preview/logic/mgmt/2018-07-01-preview/logic/logicapi/interfaces.go b/services/preview/logic/mgmt/2018-07-01-preview/logic/logicapi/interfaces.go index 4d949736cd29..5f33f0ecaf2e 100644 --- a/services/preview/logic/mgmt/2018-07-01-preview/logic/logicapi/interfaces.go +++ b/services/preview/logic/mgmt/2018-07-01-preview/logic/logicapi/interfaces.go @@ -84,6 +84,7 @@ var _ WorkflowTriggerHistoriesClientAPI = (*logic.WorkflowTriggerHistoriesClient // WorkflowRunsClientAPI contains the set of methods on the WorkflowRunsClient type. type WorkflowRunsClientAPI interface { Cancel(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) + Delete(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result logic.WorkflowRun, err error) List(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result logic.WorkflowRunListResultPage, err error) } diff --git a/services/preview/logic/mgmt/2018-07-01-preview/logic/workflowruns.go b/services/preview/logic/mgmt/2018-07-01-preview/logic/workflowruns.go index a8d54498ac16..a861e1f3b5d1 100644 --- a/services/preview/logic/mgmt/2018-07-01-preview/logic/workflowruns.go +++ b/services/preview/logic/mgmt/2018-07-01-preview/logic/workflowruns.go @@ -118,6 +118,84 @@ func (client WorkflowRunsClient) CancelResponder(resp *http.Response) (result au return } +// Delete deletes a workflow run. +// Parameters: +// resourceGroupName - the resource group name. +// workflowName - the workflow name. +// runName - the workflow run name. +func (client WorkflowRunsClient) Delete(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, workflowName, runName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkflowRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkflowRunsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets a workflow run. // Parameters: // resourceGroupName - the resource group name.