generated from kestra-io/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new tasks for Azure EventHubs (#38)
This commit adds the following tasks types: * io.kesta.plugin.azure.messaging.eventhubs.Produce * io.kesta.plugin.azure.messaging.eventhubs.Consume * io.kesta.plugin.azure.messaging.eventhubs.Trigger
- Loading branch information
1 parent
da6c414
commit 9426b80
Showing
47 changed files
with
2,769 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/io/kestra/plugin/azure/client/AzureClientConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.kestra.plugin.azure.client; | ||
|
||
import io.kestra.core.exceptions.IllegalVariableEvaluationException; | ||
import io.kestra.core.runners.RunContext; | ||
import io.kestra.plugin.azure.AzureClientInterface; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Supplier; | ||
|
||
import static io.kestra.core.utils.Rethrow.throwFunction; | ||
|
||
/** | ||
* Configuration for creating a new Azure Client. | ||
*/ | ||
public class AzureClientConfig<T extends AzureClientInterface> { | ||
|
||
protected final RunContext runContext; | ||
protected final T plugin; | ||
|
||
/** | ||
* Creates a new {@link AzureClientConfig} instance. | ||
* | ||
* @param runContext The context. | ||
* @param plugin The plugin. | ||
*/ | ||
public AzureClientConfig(final RunContext runContext, | ||
final T plugin) { | ||
this.runContext = runContext; | ||
this.plugin = plugin; | ||
} | ||
|
||
public Optional<String> connectionString() throws IllegalVariableEvaluationException { | ||
return getOptionalConfig(plugin::getConnectionString); | ||
} | ||
|
||
public Optional<String> sharedKeyAccountName() throws IllegalVariableEvaluationException { | ||
return getOptionalConfig(plugin::getSharedKeyAccountName); | ||
} | ||
|
||
public Optional<String> sharedKeyAccountAccessKey() throws IllegalVariableEvaluationException { | ||
return getOptionalConfig(plugin::getSharedKeyAccountAccessKey); | ||
} | ||
|
||
public Optional<String> sasToken() throws IllegalVariableEvaluationException { | ||
return getOptionalConfig(plugin::getSasToken); | ||
} | ||
|
||
protected Optional<String> getOptionalConfig(final Supplier<String> supplier) throws IllegalVariableEvaluationException { | ||
return Optional.ofNullable(supplier.get()).map(throwFunction(runContext::render)); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/io/kestra/plugin/azure/eventhubs/AbstractEventHubTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.kestra.plugin.azure.eventhubs; | ||
|
||
import io.kestra.core.models.tasks.Task; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@NoArgsConstructor | ||
@SuperBuilder | ||
@Getter | ||
public class AbstractEventHubTask extends Task implements EventHubClientInterface { | ||
|
||
private String connectionString; | ||
|
||
private String sharedKeyAccountName; | ||
|
||
private String sharedKeyAccountAccessKey; | ||
|
||
private String sasToken; | ||
|
||
@Builder.Default | ||
private Integer clientMaxRetries = 5; | ||
|
||
@Builder.Default | ||
private Long clientRetryDelay = 500L; | ||
|
||
private String namespace; | ||
|
||
private String eventHubName; | ||
|
||
private String customEndpointAddress; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/kestra/plugin/azure/eventhubs/BlobContainerClientInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.kestra.plugin.azure.eventhubs; | ||
|
||
import io.kestra.core.models.annotations.PluginProperty; | ||
import io.kestra.plugin.azure.AzureClientInterface; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
/** | ||
* This class is suffixed 'Interface' as it used to capture parameters from task properties. | ||
*/ | ||
@SuperBuilder | ||
@Getter | ||
public final class BlobContainerClientInterface implements AzureClientInterface { | ||
|
||
private String connectionString; | ||
private String sharedKeyAccountName; | ||
private String sharedKeyAccountAccessKey; | ||
private String sasToken; | ||
@Schema( | ||
title = "The blob container name." | ||
) | ||
@PluginProperty(dynamic = true) | ||
private String containerName; | ||
} | ||
|
Oops, something went wrong.