// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.analytics.purview.workflow.generated;

import com.azure.analytics.purview.workflow.PurviewWorkflowClient;
import com.azure.analytics.purview.workflow.PurviewWorkflowClientBuilder;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Configuration;
import com.azure.identity.DefaultAzureCredentialBuilder;

public class WorkflowRunsList {
    public static void main(String[] args) {
        PurviewWorkflowClient purviewWorkflowClient =
                new PurviewWorkflowClientBuilder()
                        .credential(new DefaultAzureCredentialBuilder().build())
                        .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT"))
                        .buildClient();
        // BEGIN:com.azure.analytics.purview.workflow.generated.listworkflowruns.workflowrunslist
        RequestOptions requestOptions =
                new RequestOptions()
                        .addQueryParam("maxpagesize", "1000")
                        .addQueryParam("orderby", "startTime desc")
                        .addQueryParam("timeWindow", "30d");
        PagedIterable<BinaryData> response = purviewWorkflowClient.listWorkflowRuns(requestOptions);
        // END:com.azure.analytics.purview.workflow.generated.listworkflowruns.workflowrunslist
    }
}
