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.
The newest version!
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.Locale;
import java.util.Map;
import java.util.Optional;
import jakarta.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
@Builder.Default
private Boolean wait = false;
@Schema(
title = "The duration to wait between the polls."
)
@NotNull
@Builder.Default
@PluginProperty
private final Duration pollDuration = Duration.ofSeconds(5);
@Schema(
title = "The maximum duration to wait until the refresh completes."
)
@NotNull
@Builder.Default
@PluginProperty
private final Duration waitDuration = Duration.ofMinutes(10);
@Override
public RefreshGroupDataset.Output run(RunContext runContext) throws Exception {
Logger logger = runContext.logger();
HttpResponse