io.kestra.plugin.powerbi.RefreshGroupDataset Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plugin-powerbi Show documentation
Show all versions of plugin-powerbi Show documentation
Embed Power BI reports and dashboards within Kestra data workflows.
package io.kestra.plugin.powerbi;
import io.kestra.core.utils.Await;
import io.kestra.plugin.powerbi.models.Refresh;
import io.kestra.plugin.powerbi.models.Refreshes;
import io.micronaut.core.type.Argument;
import io.micronaut.http.*;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.uri.UriTemplate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
import org.slf4j.Logger;
import java.time.Duration;
import java.util.Map;
import java.util.Optional;
import javax.validation.constraints.NotNull;
import static io.kestra.core.utils.Rethrow.throwSupplier;
@SuperBuilder
@ToString
@EqualsAndHashCode
@Getter
@NoArgsConstructor
@Schema(
title = "Triggers a refresh for the specified dataset from the specified workspace.",
description = "An [asynchronous refresh](https://docs.microsoft.com/en-us/power-bi/connect-data/asynchronous-refresh) would be triggered."
)
public class RefreshGroupDataset extends AbstractPowerBi implements RunnableTask {
@Schema(
title = "The workspace ID"
)
@PluginProperty(dynamic = true)
private String groupId;
@Schema(
title = "The dataset ID"
)
@PluginProperty(dynamic = true)
private String datasetId;
@Schema(
title = "Wait for refresh completion."
)
@PluginProperty(dynamic = false)
private Boolean wait = false;
@Schema(
title = "The maximum duration we need to wait until the refresh complete."
)
@NotNull
@Builder.Default
@PluginProperty(dynamic = false)
private final Duration waitDuration = Duration.ofMinutes(10);
@Override
public RefreshGroupDataset.Output run(RunContext runContext) throws Exception {
Logger logger = runContext.logger();
HttpResponse