All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.kestra.plugin.aws.sqs.model.Message Maven / Gradle / Ivy

The newest version!
package io.kestra.plugin.aws.sqs.model;

import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.runners.RunContext;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.extern.jackson.Jacksonized;
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;

import jakarta.validation.constraints.NotNull;

@Getter
@Builder
@Jacksonized
public class Message implements io.kestra.core.models.tasks.Output {
    @Schema(title = "The message data.")
    @PluginProperty(dynamic = true)
    @NotNull
    private String data;

    @Schema(title = "The message group ID.")
    @PluginProperty(dynamic = true)
    private String groupId;

    @Schema(title = "The message deduplication ID.")
    @PluginProperty(dynamic = true)
    private String deduplicationId;

    @Schema(title = "The message delay in seconds.")
    @PluginProperty
    private Integer delaySeconds;

    public SendMessageRequest to(SendMessageRequest.Builder builder, RunContext runContext) throws IllegalVariableEvaluationException {
        return builder
            .messageBody(runContext.render(data))
            .messageGroupId(runContext.render(groupId))
            .messageDeduplicationId(runContext.render(deduplicationId))
            .delaySeconds(delaySeconds)
            .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy