This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-24961-catalog-body-types-aws-2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5f79a696a857cfd06750f5f8b5b35b10c289aff3 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Oct 22 22:28:05 2026 +0200 CAMEL-24961: Catalog body types for eleven more AWS components Declares the body types of aws2-ddb, aws2-ddbstream, aws2-cw, aws2-ec2, aws2-eventbridge, aws2-lambda, aws2-sts, aws2-ses, aws-secrets-manager, aws2-kms and aws2-iam. All were checked at runtime with camel run against the AWS emulator of camel infra. Most of these producers take their input from headers and give the response of the AWS SDK. The bodies that are read: the secret of createSecret, updateSecret and putSecretValue, the payload of invokeFunction and the zip of createFunction and updateFunction, the detail of putEvent and the text of the mail of aws2-ses. getSecret gives the secret as text, invokeFunction the payload of the response as text, and the eventbridge consumer the event as JSON text. aws2-ddb keeps the body for every operation. Fixes the doc prose about the body of putEvent: its examples sent a plain text detail, which EventBridge rejects without failing the exchange. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../catalog/components/aws-secrets-manager.json | 4 + .../apache/camel/catalog/components/aws2-cw.json | 4 + .../apache/camel/catalog/components/aws2-ddb.json | 4 + .../camel/catalog/components/aws2-ddbstream.json | 3 + .../apache/camel/catalog/components/aws2-ec2.json | 4 + .../camel/catalog/components/aws2-eventbridge.json | 5 + .../apache/camel/catalog/components/aws2-iam.json | 4 + .../apache/camel/catalog/components/aws2-kms.json | 4 + .../camel/catalog/components/aws2-lambda.json | 4 + .../apache/camel/catalog/components/aws2-ses.json | 4 + .../apache/camel/catalog/components/aws2-sts.json | 4 + .../catalog/docs/aws2-eventbridge-component.adoc | 10 +- .../aws/secretsmanager/aws-secrets-manager.json | 4 + .../aws/secretsmanager/SecretsManagerEndpoint.java | 32 ++++++ .../apache/camel/component/aws2/cw/aws2-cw.json | 4 + .../camel/component/aws2/cw/Cw2Endpoint.java | 20 ++++ .../apache/camel/component/aws2/ddb/aws2-ddb.json | 4 + .../component/aws2/ddbstream/aws2-ddbstream.json | 3 + .../camel/component/aws2/ddb/Ddb2Endpoint.java | 11 ++ .../aws2/ddbstream/Ddb2StreamEndpoint.java | 8 ++ .../apache/camel/component/aws2/ec2/aws2-ec2.json | 4 + .../camel/component/aws2/ec2/AWS2EC2Endpoint.java | 43 +++++++ .../aws2/eventbridge/aws2-eventbridge.json | 5 + .../src/main/docs/aws2-eventbridge-component.adoc | 10 +- .../aws2/eventbridge/EventbridgeEndpoint.java | 21 ++++ .../apache/camel/component/aws2/iam/aws2-iam.json | 4 + .../camel/component/aws2/iam/IAM2Endpoint.java | 12 ++ .../apache/camel/component/aws2/kms/aws2-kms.json | 4 + .../camel/component/aws2/kms/KMS2Endpoint.java | 12 ++ .../camel/component/aws2/lambda/aws2-lambda.json | 4 + .../component/aws2/lambda/Lambda2Endpoint.java | 28 +++++ .../apache/camel/component/aws2/ses/aws2-ses.json | 4 + .../camel/component/aws2/ses/Ses2Endpoint.java | 10 ++ .../apache/camel/component/aws2/sts/aws2-sts.json | 4 + .../camel/component/aws2/sts/STS2Endpoint.java | 13 +++ .../camel/dsl/yaml/validator/TextBodyFlowTest.java | 127 +++++++++++++++++++++ 36 files changed, 435 insertions(+), 10 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-secrets-manager.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-secrets-manager.json index e51230bfd748..7320b4ba2a26 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-secrets-manager.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-secrets-manager.json @@ -62,6 +62,10 @@ "CamelAwsSecretsManagerSecretReplicationRegions": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A comma separated list of Regions in which to replicate the secret.", "constantName": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConstants#SECRET_REPLICATION_REGIONS" }, "CamelAwsSecretsManagerSecretForceDeletion": { "index": 10, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If this header is set to true, the deleted secret won't have any retention period.", "constantName": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConstants#SECRET_FORCE_DELETION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "createSecret", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "updateSecret", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "putSecretValue", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The value of the secret for createSecret, updateSecret and putSecretValue, as text: bytes, a stream or a f [...] + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "getSecret", "carriers": [ "text", "null" ] }, { "option": "operation", "value": "batchGetSecret", "carriers": [ "list" ], "javaType": "java.util.List<java.lang.String>" } ], "description": "The value of the secret as text for getSecret, with its version id in a header: unmarshal a JSON secret to read its fields. No body for a binary secret unless binaryPayload=true. A List of the values for batc [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Logical name" }, "binaryPayload": { "index": 1, "kind": "parameter", "displayName": "Binary Payload", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set if the secret is binary or not" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-cw.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-cw.json index 33c68755fea8..0ed76e9b27f3 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-cw.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-cw.json @@ -66,6 +66,10 @@ "CamelAwsCwMaxResults": { "index": 12, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.cw.Cw2Constants#MAX_RESULTS" }, "CamelAwsCwIsTruncated": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.cw.Cw2Constants#IS_TRUNCATED" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "putMetricData sends a body that is a MetricDatum of the AWS SDK or a List of them, and a List of anything else fails; with another body the metric comes from the CamelAwsCwMetric* headers or the name, value and unit options. The other operations do not use the body" }, + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "operation", "value": "listMetrics", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.cloudwatch.model.ListMetricsResponse" }, { "option": "operation", "value": "describeAlarms", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmsResponse" }, { "option": "operation", "value": "describeAlarmsForMetric", "carriers": [ "pojo" ], "javaType": "softwa [...] + }, "properties": { "namespace": { "index": 0, "kind": "path", "displayName": "Namespace", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "The metric namespace" }, "name": { "index": 1, "kind": "parameter", "displayName": "Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "The metric name" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json index 503f57fa320a..6b63b79c6180 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json @@ -105,6 +105,10 @@ "CamelAwsDdbFilterExpressionAttributeValues": { "index": 48, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" }, "CamelAwsDdbProjectExpression": { "index": 49, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "Not used: the operations take their input from headers, such as the item in CamelAwsDdbItem and the key in CamelAwsDdbKey as maps of the AttributeValue of the AWS SDK, or the PartiQL statement in CamelAwsDdbStatement" }, + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged for every operation: the result is in headers, such as CamelAwsDdbAttributes for the item operations, CamelAwsDdbItems for Query and Scan, and CamelAwsDdbExecuteStatementItems for ExecuteStatement" } + }, "properties": { "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." }, "consistentRead": { "index": 1, "kind": "parameter", "displayName": "Consistent Read", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Determines whether strong consistency should be enforced when data is read." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddbstream.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddbstream.json index 477b4087b438..f269fad666bb 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddbstream.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddbstream.json @@ -47,6 +47,9 @@ "useProfileCredentialsProvider": { "index": 20, "kind": "property", "displayName": "Use Profile Credentials Provider", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Set whether the Cloudtrail client shoul [...] "useSessionCredentials": { "index": 21, "kind": "property", "displayName": "Use Session Credentials", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Set whether the DDB Streams client should expect to use [...] }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.dynamodb.model.Record", "description": "The change record of the stream, one message per record, with the event name (INSERT, MODIFY or REMOVE) in a header. The keys and the images of the item are maps of AttributeValue in body.dynamodb(). A Record is not a JavaBean, so Jackson cannot marshal it" } + }, "properties": { "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "consumer", "label": "consumer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Name of the dynamodb table" }, "maxResultsPerRequest": { "index": 1, "kind": "parameter", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Maximum number of records that will be fetched in each poll" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json index 9f0d4dd0aeb1..4e1c54e7ddfa 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ec2.json @@ -67,6 +67,10 @@ "CamelAwsEC2MaxResults": { "index": 16, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#MAX_RESULTS" }, "CamelAwsEC2IsTruncated": { "index": 17, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#IS_TRUNCATED" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the operations take their input from headers, such as the ids of the instances in CamelAwsEC2InstancesIds as a Collection. With pojoRequest=true the request of the AWS SDK for the operation, such as a DescribeInstancesRequest: another body fails" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "operation", "value": "createAndRunInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.ec2.model.RunInstancesResponse" }, { "option": "operation", "value": "startInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.ec2.model.StartInstancesResponse" }, { "option": "operation", "value": "stopInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssd [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "Logical name" }, "amazonEc2Client": { "index": 1, "kind": "parameter", "displayName": "Amazon Ec2 Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.ec2.Ec2Client", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "To use an existing configured AmazonEC2Cl [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json index 4180e811e0ae..46439d631729 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json @@ -75,6 +75,11 @@ "CamelAwsEventbridgeMessageId": { "index": 15, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The SQS message ID.", "constantName": "org.apache.camel.component.aws2.eventbridge.EventbridgeConstants#MESSAGE_ID" }, "CamelAwsEventbridgeReceiptHandle": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The SQS receipt handle for message deletion.", "constantName": "org.apache.camel.component.aws2.eventbridge.EventbridgeConstants#RECEIPT_HANDLE" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The event as JSON text, one message per event the rule sends to the SQS queue of the consumer: the envelope of EventBridge, with the data of the event in its detail field, and the id of the SQS message in a header" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putEvent", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "Not used by putRule, the default, and the other operations, which take their input from headers and the eventPatternFile option. putEvent sends the body as the detail of the event, which must be a JSON object as text: bytes, a stream or a file are read as text, a Map or a POJO is sent as its toString(), so marshal it [...] + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation: a PutRuleResponse for putRule, the default, and a PutEventsResponse for putEvent. An event that AWS rejects, such as one whose detail is not a JSON object, does not fail the exchange: check the CamelAwsEventbridgeFailedEntryCount header" } + }, "properties": { "eventbusNameOrArn": { "index": 0, "kind": "path", "displayName": "Eventbus Name Or Arn", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Event bus name or ARN" }, "eventPatternFile": { "index": 1, "kind": "parameter", "displayName": "Event Pattern File", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-iam.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-iam.json index e00e496a653a..c4f64ff5c5cb 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-iam.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-iam.json @@ -79,6 +79,10 @@ "CamelAwsIAMInstanceProfileArn": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of an AWS IAM Instance Profile", "constantName": "org.apache.camel.component.aws2.iam.IAM2Constants#INSTANCE_PROFILE_ARN" }, "CamelAwsIAMInstanceProfileId": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of an AWS IAM Instance Profile", "constantName": "org.apache.camel.component.aws2.iam.IAM2Constants#INSTANCE_PROFILE_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the names, the ARNs and the policy documents come from headers, such as CamelAwsIAMUsername. With pojoRequest=true the request of the AWS SDK for the operation, such as a CreateUserRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the CreateUserResponse of createUser; the create and get operations put the ARN and the id in headers too" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "Logical name" }, "iamClient": { "index": 1, "kind": "parameter", "displayName": "Iam Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.iam.IamClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To use an existing configured AWS IAM client" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kms.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kms.json index 4343f5c9c43e..9b34dd2aafd1 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kms.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-kms.json @@ -57,6 +57,10 @@ "CamelAwsKMSKeyState": { "index": 8, "kind": "header", "displayName": "", "group": "createKey describeKey", "label": "createKey describeKey", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The state of the key.", "constantName": "org.apache.camel.component.aws2.kms.KMS2Constants#KEY_STATE" }, "CamelAwsKMSDeletionDate": { "index": 9, "kind": "header", "displayName": "", "group": "scheduleKeyDeletion", "label": "scheduleKeyDeletion", "required": false, "javaType": "java.time.Instant", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The date and time after which AWS KMS deletes the key.", "constantName": "org.apache.camel.component.aws2.kms.KMS2Constants#DELETION_DATE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the key id and the other inputs come from headers, such as CamelAwsKMSKeyId. With pojoRequest=true the request of the AWS SDK for the operation, such as a ListKeysRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the CreateKeyResponse of createKey, which puts the id, the ARN and the state of the key in headers too" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kms.KMS2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.kms.KMS2Operations", "enum": [ "listKeys", "createKey", "disableKey", "scheduleKeyDeletion", "describeKey", "enableKey" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kms.KMS2Configuration", "configurationFi [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-lambda.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-lambda.json index 8489a1167f94..91d53de5ac09 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-lambda.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-lambda.json @@ -105,6 +105,10 @@ "CamelAwsLambdaSourceAccount": { "index": 54, "kind": "header", "displayName": "", "group": "addPermission", "label": "addPermission", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon Web Services account ID of the principal.", "constantName": "org.apache.camel.component.aws2.lambda.Lambda2Constants#SOURCE_ACCOUNT" }, "CamelAwsLambdaSourceArn": { "index": 55, "kind": "header", "displayName": "", "group": "addPermission", "label": "addPermission", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.", "constantName": "org.apache.camel.component.aws2.lambda.Lambda2Constants#SOURCE_ARN" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "dependsOn": [ "operation" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "createFunction", "carriers": [ "bytes", "stream", "file", "null" ] }, { "option": "operation", "value": "updateFunction", "carriers": [ "bytes", "stream", "file", "null" ] } ], "description": "The payload of invokeFunction, the default, [...] + "producerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "dependsOn": [ "operation" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text" ], "javaType": "java.lang.String" } ], "description": "The payload of the response of invokeFunction, the default, as text: the JSON the function returns, or the JSON of its error with the CamelAwsLambdaFunctionError header set, as an error of the function does not fail the exchange. The response [...] + }, "properties": { "function": { "index": 0, "kind": "path", "displayName": "Function", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the Lambda function." }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.lambda.Lambda2Operations", "enum": [ "listFunctions", "getFunction", "createAlias", "deleteAlias", "getAlias", "listAliases", "createFunction", "deleteFunction", "invokeFunction", "updateFunction", "createEventSourceMapping", "deleteEventSourceMapping", "listEventSourceMapping", "listTags", "tagRe [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ses.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ses.json index fe819d72e0df..5e0a96e16627 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ses.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ses.json @@ -65,6 +65,10 @@ "CamelAwsSesHtmlEmail": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag to show if email content is HTML.", "constantName": "org.apache.camel.component.aws2.ses.Ses2Constants#HTML_EMAIL" }, "CamelAwsSesConfigurationSet": { "index": 10, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "TThe configuration set to send.", "constantName": "org.apache.camel.component.aws2.ses.Ses2Constants#CONFIGURATION_SET" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text of the mail, or its HTML with the CamelAwsSesHtmlEmail header set to true: bytes, a stream or a file are read as text, and a Map or a POJO is sent as its toString(), so marshal it first. A jakarta.mail Message is sent as a raw mail as it is" }, + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged, with the id of the mail in the CamelAwsSesMessageId header" } + }, "properties": { "from": { "index": 0, "kind": "path", "displayName": "From", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "The sender's email address." }, "bcc": { "index": 1, "kind": "parameter", "displayName": "Bcc", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "List of comma-separated destination blind carbon copy (bcc) email address. Can be overridden with 'CamelAwsSesBcc' header." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sts.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sts.json index ba45cde1c621..7c8f668b5c00 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sts.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-sts.json @@ -55,6 +55,10 @@ "CamelAwsStsExpiration": { "index": 8, "kind": "header", "displayName": "", "group": "assumeRole getSessionToken getFederationToken", "label": "assumeRole getSessionToken getFederationToken", "required": false, "javaType": "java.time.Instant", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expiration date and time of the credentials.", "constantName": "org.apache.camel.component.aws2.sts.STS2Constants#EXPIRATION" }, "CamelAwsStsAssumedRoleArn": { "index": 9, "kind": "header", "displayName": "", "group": "assumeRole", "label": "assumeRole", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon Resource Name (ARN) of the assumed role.", "constantName": "org.apache.camel.component.aws2.sts.STS2Constants#ASSUMED_ROLE_ARN" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: assumeRole takes the role from the CamelAwsStsRoleArn and CamelAwsStsRoleSessionName headers, and getFederationToken the name from CamelAwsStsFederatedName. With pojoRequest=true the request of the AWS SDK for the operation, such as an AssumeRoleRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the AssumeRoleResponse of assumeRole, the default, with the temporary credentials in credentials()" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sts.STS2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.sts.STS2Operations", "enum": [ "assumeRole", "getSessionToken", "getFederationToken" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "assumeRole", "configurationClass": "org.apache.camel.component.aws2.sts.STS2Configuration", "configurationField": [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc index ff540e28fcc4..14d96c4076b7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc @@ -522,7 +522,7 @@ YAML:: This operation will return a list of rules associated with a target. -- PutEvent: this operation will send an event to the Servicebus +- PutEvent: this operation will send an event to the event bus, with the message body as the detail of the event, which must be a JSON object as text [tabs] ==== @@ -534,7 +534,7 @@ from("direct:start") .setHeader("CamelAwsEventbridgeResourcesArn", constant("arn:aws:sqs:eu-west-1:780410022472:camel-connector-test")) .setHeader("CamelAwsEventbridgeSource", constant("com.pippo")) .setHeader("CamelAwsEventbridgeDetailType", constant("peppe")) - .setBody(constant("Test Event")) + .setBody(constant("{\"message\": \"Test Event\"}")) .to("aws2-eventbridge://test?operation=putEvent") .to("mock:result"); ---- @@ -555,7 +555,7 @@ XML:: <constant>peppe</constant> </setHeader> <setBody> - <constant>Test Event</constant> + <constant>{"message": "Test Event"}</constant> </setBody> <to uri="aws2-eventbridge://test?operation=putEvent"/> <to uri="mock:result"/> @@ -580,7 +580,7 @@ YAML:: name: CamelAwsEventbridgeDetailType constant: peppe - setBody: - constant: Test Event + constant: '{"message": "Test Event"}' - to: uri: aws2-eventbridge://test parameters: @@ -590,7 +590,7 @@ YAML:: ---- ==== -This operation will return a list of entries with related ID sent to servicebus. +The message body is then the `PutEventsResponse`, with the id of each event in its entries. An event that AWS rejects, such as one whose detail is not a JSON object, does not fail the exchange: the `CamelAwsEventbridgeFailedEntryCount` header counts the events that were rejected. === Updating the rule diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json index e51230bfd748..7320b4ba2a26 100644 --- a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json @@ -62,6 +62,10 @@ "CamelAwsSecretsManagerSecretReplicationRegions": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A comma separated list of Regions in which to replicate the secret.", "constantName": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConstants#SECRET_REPLICATION_REGIONS" }, "CamelAwsSecretsManagerSecretForceDeletion": { "index": 10, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If this header is set to true, the deleted secret won't have any retention period.", "constantName": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConstants#SECRET_FORCE_DELETION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "createSecret", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "updateSecret", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "putSecretValue", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The value of the secret for createSecret, updateSecret and putSecretValue, as text: bytes, a stream or a f [...] + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "getSecret", "carriers": [ "text", "null" ] }, { "option": "operation", "value": "batchGetSecret", "carriers": [ "list" ], "javaType": "java.util.List<java.lang.String>" } ], "description": "The value of the secret as text for getSecret, with its version id in a header: unmarshal a JSON secret to read its fields. No body for a binary secret unless binaryPayload=true. A List of the values for batc [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Logical name" }, "binaryPayload": { "index": 1, "kind": "parameter", "displayName": "Binary Payload", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set if the secret is binary or not" }, diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java index 750b03aefa05..c5021ddbdd86 100644 --- a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws.secretsmanager.client.SecretsManagerClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -39,6 +42,35 @@ import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; @Metadata(annotations = { "vault=aws-secrets-manager", }) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "operation", value = "createSecret", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "operation", value = "updateSecret", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "operation", value = "putSecretValue", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }) }, + description = "The value of the secret for createSecret, updateSecret and putSecretValue, as" + + " text: bytes, a stream or a file are read as text, a Map or a POJO is stored" + + " as its toString(), so marshal it first, and no body fails. The other" + + " operations take their input from headers. With pojoRequest=true the body is" + + " the request of the AWS SDK for the operation, such as a" + + " CreateSecretRequest"), + producerOut = @BodyType(value = Carrier.POJO, + byOption = { + @BodyType.When(option = "operation", value = "getSecret", + carriers = { Carrier.TEXT, Carrier.NULL }), + @BodyType.When(option = "operation", value = "batchGetSecret", + carriers = Carrier.LIST, + javaType = "java.util.List<java.lang.String>") }, + description = "The value of the secret as text for getSecret, with its version id in a" + + " header: unmarshal a JSON secret to read its fields. No body for a binary" + + " secret unless binaryPayload=true. A List of the values for batchGetSecret," + + " and the response of the AWS SDK for the other operations, such as a" + + " CreateSecretResponse")) public class SecretsManagerEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private SecretsManagerClient secretsManagerClient; diff --git a/components/camel-aws/camel-aws2-cw/src/generated/resources/META-INF/org/apache/camel/component/aws2/cw/aws2-cw.json b/components/camel-aws/camel-aws2-cw/src/generated/resources/META-INF/org/apache/camel/component/aws2/cw/aws2-cw.json index 33c68755fea8..0ed76e9b27f3 100644 --- a/components/camel-aws/camel-aws2-cw/src/generated/resources/META-INF/org/apache/camel/component/aws2/cw/aws2-cw.json +++ b/components/camel-aws/camel-aws2-cw/src/generated/resources/META-INF/org/apache/camel/component/aws2/cw/aws2-cw.json @@ -66,6 +66,10 @@ "CamelAwsCwMaxResults": { "index": 12, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.cw.Cw2Constants#MAX_RESULTS" }, "CamelAwsCwIsTruncated": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.cw.Cw2Constants#IS_TRUNCATED" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "putMetricData sends a body that is a MetricDatum of the AWS SDK or a List of them, and a List of anything else fails; with another body the metric comes from the CamelAwsCwMetric* headers or the name, value and unit options. The other operations do not use the body" }, + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "operation", "value": "listMetrics", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.cloudwatch.model.ListMetricsResponse" }, { "option": "operation", "value": "describeAlarms", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmsResponse" }, { "option": "operation", "value": "describeAlarmsForMetric", "carriers": [ "pojo" ], "javaType": "softwa [...] + }, "properties": { "namespace": { "index": 0, "kind": "path", "displayName": "Namespace", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "The metric namespace" }, "name": { "index": 1, "kind": "parameter", "displayName": "Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "The metric name" }, diff --git a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java index 59dc58049473..d68aa3a9ea4a 100644 --- a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java +++ b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java @@ -24,6 +24,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.cw.client.Cw2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,6 +39,23 @@ import software.amazon.awssdk.services.cloudwatch.CloudWatchClient; */ @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-cw", title = "AWS CloudWatch", syntax = "aws2-cw:namespace", producerOnly = true, category = { Category.CLOUD, Category.MONITORING }, headersClass = Cw2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "putMetricData sends a body that is a MetricDatum of the AWS SDK or a List of" + + " them, and a List of anything else fails; with another body the metric comes" + + " from the CamelAwsCwMetric* headers or the name, value and unit options. The" + + " other operations do not use the body"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + byOption = { + @BodyType.When(option = "operation", value = "listMetrics", carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.cloudwatch.model.ListMetricsResponse"), + @BodyType.When(option = "operation", value = "describeAlarms", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmsResponse"), + @BodyType.When(option = "operation", value = "describeAlarmsForMetric", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.cloudwatch.model.DescribeAlarmsForMetricResponse") }, + description = "Unchanged after putMetricData, the default. The response of the AWS SDK for" + + " listMetrics, describeAlarms and describeAlarmsForMetric")) public class Cw2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { @UriParam diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json index 503f57fa320a..6b63b79c6180 100644 --- a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json +++ b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json @@ -105,6 +105,10 @@ "CamelAwsDdbFilterExpressionAttributeValues": { "index": 48, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" }, "CamelAwsDdbProjectExpression": { "index": 49, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "Not used: the operations take their input from headers, such as the item in CamelAwsDdbItem and the key in CamelAwsDdbKey as maps of the AttributeValue of the AWS SDK, or the PartiQL statement in CamelAwsDdbStatement" }, + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged for every operation: the result is in headers, such as CamelAwsDdbAttributes for the item operations, CamelAwsDdbItems for Query and Scan, and CamelAwsDdbExecuteStatementItems for ExecuteStatement" } + }, "properties": { "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." }, "consistentRead": { "index": 1, "kind": "parameter", "displayName": "Consistent Read", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Determines whether strong consistency should be enforced when data is read." }, diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json index 477b4087b438..f269fad666bb 100644 --- a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json +++ b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddbstream/aws2-ddbstream.json @@ -47,6 +47,9 @@ "useProfileCredentialsProvider": { "index": 20, "kind": "property", "displayName": "Use Profile Credentials Provider", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Set whether the Cloudtrail client shoul [...] "useSessionCredentials": { "index": 21, "kind": "property", "displayName": "Use Session Credentials", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Set whether the DDB Streams client should expect to use [...] }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.dynamodb.model.Record", "description": "The change record of the stream, one message per record, with the event name (INSERT, MODIFY or REMOVE) in a header. The keys and the images of the item are maps of AttributeValue in body.dynamodb(). A Record is not a JavaBean, so Jackson cannot marshal it" } + }, "properties": { "tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "consumer", "label": "consumer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Name of the dynamodb table" }, "maxResultsPerRequest": { "index": 1, "kind": "parameter", "displayName": "Max Results Per Request", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddbstream.Ddb2StreamConfiguration", "configurationField": "configuration", "description": "Maximum number of records that will be fetched in each poll" }, diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java index ace1cb5f07ed..76d4fc1bdd47 100644 --- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java +++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java @@ -26,6 +26,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; import org.apache.camel.component.aws2.ddb.client.Ddb2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -54,6 +57,14 @@ import software.amazon.awssdk.services.dynamodb.model.TableStatus; @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ddb", title = "AWS DynamoDB", syntax = "aws2-ddb:tableName", producerOnly = true, category = { Category.CLOUD, Category.DATABASE }, headersClass = Ddb2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "Not used: the operations take their input from headers, such as the item in" + + " CamelAwsDdbItem and the key in CamelAwsDdbKey as maps of the AttributeValue" + + " of the AWS SDK, or the PartiQL statement in CamelAwsDdbStatement"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + description = "Unchanged for every operation: the result is in headers, such as" + + " CamelAwsDdbAttributes for the item operations, CamelAwsDdbItems for Query" + + " and Scan, and CamelAwsDdbExecuteStatementItems for ExecuteStatement")) public class Ddb2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(Ddb2Endpoint.class); diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpoint.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpoint.java index 6c00fdda69d3..8e5a82dae83a 100644 --- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpoint.java +++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.ddbstream.client.Ddb2StreamClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,11 @@ import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient; */ @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ddbstream", title = "AWS DynamoDB Streams", consumerOnly = true, syntax = "aws2-ddbstream:tableName", category = { Category.CLOUD, Category.MESSAGING }) +@BodyTypes(consumerOut = @BodyType(value = Carrier.POJO, javaType = "software.amazon.awssdk.services.dynamodb.model.Record", + description = "The change record of the stream, one message per record, with the event name" + + " (INSERT, MODIFY or REMOVE) in a header. The keys and the images of the" + + " item are maps of AttributeValue in body.dynamodb(). A Record is not a" + + " JavaBean, so Jackson cannot marshal it")) public class Ddb2StreamEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriParam diff --git a/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json b/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json index 9f0d4dd0aeb1..4e1c54e7ddfa 100644 --- a/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json +++ b/components/camel-aws/camel-aws2-ec2/src/generated/resources/META-INF/org/apache/camel/component/aws2/ec2/aws2-ec2.json @@ -67,6 +67,10 @@ "CamelAwsEC2MaxResults": { "index": 16, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of results to return.", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#MAX_RESULTS" }, "CamelAwsEC2IsTruncated": { "index": 17, "kind": "header", "displayName": "", "group": "describeInstances describeInstancesStatus", "label": "describeInstances describeInstancesStatus", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated).", "constantName": "org.apache.camel.component.aws2.ec2.AWS2EC2Constants#IS_TRUNCATED" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the operations take their input from headers, such as the ids of the instances in CamelAwsEC2InstancesIds as a Collection. With pojoRequest=true the request of the AWS SDK for the operation, such as a DescribeInstancesRequest: another body fails" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "operation", "value": "createAndRunInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.ec2.model.RunInstancesResponse" }, { "option": "operation", "value": "startInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.ec2.model.StartInstancesResponse" }, { "option": "operation", "value": "stopInstances", "carriers": [ "pojo" ], "javaType": "software.amazon.awssd [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "Logical name" }, "amazonEc2Client": { "index": 1, "kind": "parameter", "displayName": "Amazon Ec2 Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.ec2.Ec2Client", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ec2.AWS2EC2Configuration", "configurationField": "configuration", "description": "To use an existing configured AmazonEC2Cl [...] diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java index bc8b5baff391..a01c68056d88 100644 --- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java +++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.ec2.client.AWS2EC2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,46 @@ import software.amazon.awssdk.services.ec2.Ec2Client; @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ec2", title = "AWS Elastic Compute Cloud (EC2)", syntax = "aws2-ec2:label", producerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT }, headersClass = AWS2EC2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: the operations take their input from headers, such as the ids of the" + + " instances in CamelAwsEC2InstancesIds as a Collection. With pojoRequest=true" + + " the request of the AWS SDK for the operation, such as a" + + " DescribeInstancesRequest: another body fails"), + producerOut = @BodyType(value = Carrier.UNKNOWN, + byOption = { + @BodyType.When(option = "operation", value = "createAndRunInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.RunInstancesResponse"), + @BodyType.When(option = "operation", value = "startInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.StartInstancesResponse"), + @BodyType.When(option = "operation", value = "stopInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.StopInstancesResponse"), + @BodyType.When(option = "operation", value = "terminateInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.TerminateInstancesResponse"), + @BodyType.When(option = "operation", value = "describeInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.DescribeInstancesResponse"), + @BodyType.When(option = "operation", value = "describeInstancesStatus", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.DescribeInstanceStatusResponse"), + @BodyType.When(option = "operation", value = "rebootInstances", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "monitorInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.MonitorInstancesResponse"), + @BodyType.When(option = "operation", value = "unmonitorInstances", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.UnmonitorInstancesResponse"), + @BodyType.When(option = "operation", value = "createTags", carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.CreateTagsResponse"), + @BodyType.When(option = "operation", value = "deleteTags", carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.ec2.model.DeleteTagsResponse") }, + description = "The response of the AWS SDK for the operation, such as a RunInstancesResponse" + + " for createAndRunInstances; rebootInstances keeps the body")) public class AWS2EC2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private Ec2Client ec2Client; diff --git a/components/camel-aws/camel-aws2-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json b/components/camel-aws/camel-aws2-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json index 4180e811e0ae..46439d631729 100644 --- a/components/camel-aws/camel-aws2-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json +++ b/components/camel-aws/camel-aws2-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json @@ -75,6 +75,11 @@ "CamelAwsEventbridgeMessageId": { "index": 15, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The SQS message ID.", "constantName": "org.apache.camel.component.aws2.eventbridge.EventbridgeConstants#MESSAGE_ID" }, "CamelAwsEventbridgeReceiptHandle": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The SQS receipt handle for message deletion.", "constantName": "org.apache.camel.component.aws2.eventbridge.EventbridgeConstants#RECEIPT_HANDLE" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The event as JSON text, one message per event the rule sends to the SQS queue of the consumer: the envelope of EventBridge, with the data of the event in its detail field, and the id of the SQS message in a header" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putEvent", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "Not used by putRule, the default, and the other operations, which take their input from headers and the eventPatternFile option. putEvent sends the body as the detail of the event, which must be a JSON object as text: bytes, a stream or a file are read as text, a Map or a POJO is sent as its toString(), so marshal it [...] + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation: a PutRuleResponse for putRule, the default, and a PutEventsResponse for putEvent. An event that AWS rejects, such as one whose detail is not a JSON object, does not fail the exchange: check the CamelAwsEventbridgeFailedEntryCount header" } + }, "properties": { "eventbusNameOrArn": { "index": 0, "kind": "path", "displayName": "Eventbus Name Or Arn", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Event bus name or ARN" }, "eventPatternFile": { "index": 1, "kind": "parameter", "displayName": "Event Pattern File", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" }, diff --git a/components/camel-aws/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc b/components/camel-aws/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc index ff540e28fcc4..14d96c4076b7 100644 --- a/components/camel-aws/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc +++ b/components/camel-aws/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc @@ -522,7 +522,7 @@ YAML:: This operation will return a list of rules associated with a target. -- PutEvent: this operation will send an event to the Servicebus +- PutEvent: this operation will send an event to the event bus, with the message body as the detail of the event, which must be a JSON object as text [tabs] ==== @@ -534,7 +534,7 @@ from("direct:start") .setHeader("CamelAwsEventbridgeResourcesArn", constant("arn:aws:sqs:eu-west-1:780410022472:camel-connector-test")) .setHeader("CamelAwsEventbridgeSource", constant("com.pippo")) .setHeader("CamelAwsEventbridgeDetailType", constant("peppe")) - .setBody(constant("Test Event")) + .setBody(constant("{\"message\": \"Test Event\"}")) .to("aws2-eventbridge://test?operation=putEvent") .to("mock:result"); ---- @@ -555,7 +555,7 @@ XML:: <constant>peppe</constant> </setHeader> <setBody> - <constant>Test Event</constant> + <constant>{"message": "Test Event"}</constant> </setBody> <to uri="aws2-eventbridge://test?operation=putEvent"/> <to uri="mock:result"/> @@ -580,7 +580,7 @@ YAML:: name: CamelAwsEventbridgeDetailType constant: peppe - setBody: - constant: Test Event + constant: '{"message": "Test Event"}' - to: uri: aws2-eventbridge://test parameters: @@ -590,7 +590,7 @@ YAML:: ---- ==== -This operation will return a list of entries with related ID sent to servicebus. +The message body is then the `PutEventsResponse`, with the id of each event in its entries. An event that AWS rejects, such as one whose detail is not a JSON object, does not fail the exchange: the `CamelAwsEventbridgeFailedEntryCount` header counts the events that were rejected. === Updating the rule diff --git a/components/camel-aws/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeEndpoint.java b/components/camel-aws/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeEndpoint.java index cafdc9b673c0..93064827870d 100644 --- a/components/camel-aws/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeEndpoint.java +++ b/components/camel-aws/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeEndpoint.java @@ -27,6 +27,7 @@ import org.apache.camel.Producer; import org.apache.camel.component.aws.common.AwsClientBuilderUtil; import org.apache.camel.component.aws2.eventbridge.client.EventbridgeClientFactory; import org.apache.camel.spi.*; +import org.apache.camel.spi.BodyType.Carrier; import org.apache.camel.support.ScheduledPollEndpoint; import org.apache.camel.util.ObjectHelper; import software.amazon.awssdk.services.eventbridge.EventBridgeClient; @@ -40,6 +41,26 @@ import software.amazon.awssdk.services.sqs.SqsClient; Category.CLOUD, Category.MANAGEMENT }, headersClass = EventbridgeConstants.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.TEXT, javaType = "java.lang.String", + description = "The event as JSON text, one message per event the rule sends to the SQS queue" + + " of the consumer: the envelope of EventBridge, with the data of the event" + + " in its detail field, and the id of the SQS message in a header"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "operation", value = "putEvent", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + description = "Not used by putRule, the default, and the other operations, which take their" + + " input from headers and the eventPatternFile option. putEvent sends the body" + + " as the detail of the event, which must be a JSON object as text: bytes, a" + + " stream or a file are read as text, a Map or a POJO is sent as its" + + " toString(), so marshal it first, and no body fails. With pojoRequest=true" + + " the request of the AWS SDK, such as a PutEventsRequest"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation: a PutRuleResponse for putRule," + + " the default, and a PutEventsResponse for putEvent. An event that AWS" + + " rejects, such as one whose detail is not a JSON object, does not fail the" + + " exchange: check the CamelAwsEventbridgeFailedEntryCount header")) public class EventbridgeEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private final ReentrantLock lock = new ReentrantLock(); diff --git a/components/camel-aws/camel-aws2-iam/src/generated/resources/META-INF/org/apache/camel/component/aws2/iam/aws2-iam.json b/components/camel-aws/camel-aws2-iam/src/generated/resources/META-INF/org/apache/camel/component/aws2/iam/aws2-iam.json index e00e496a653a..c4f64ff5c5cb 100644 --- a/components/camel-aws/camel-aws2-iam/src/generated/resources/META-INF/org/apache/camel/component/aws2/iam/aws2-iam.json +++ b/components/camel-aws/camel-aws2-iam/src/generated/resources/META-INF/org/apache/camel/component/aws2/iam/aws2-iam.json @@ -79,6 +79,10 @@ "CamelAwsIAMInstanceProfileArn": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of an AWS IAM Instance Profile", "constantName": "org.apache.camel.component.aws2.iam.IAM2Constants#INSTANCE_PROFILE_ARN" }, "CamelAwsIAMInstanceProfileId": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ID of an AWS IAM Instance Profile", "constantName": "org.apache.camel.component.aws2.iam.IAM2Constants#INSTANCE_PROFILE_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the names, the ARNs and the policy documents come from headers, such as CamelAwsIAMUsername. With pojoRequest=true the request of the AWS SDK for the operation, such as a CreateUserRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the CreateUserResponse of createUser; the create and get operations put the ARN and the id in headers too" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "Logical name" }, "iamClient": { "index": 1, "kind": "parameter", "displayName": "Iam Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.iam.IamClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To use an existing configured AWS IAM client" }, diff --git a/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java b/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java index eaf8cf3e1524..f7a9e39aa093 100644 --- a/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java +++ b/components/camel-aws/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.iam.client.IAM2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,15 @@ import software.amazon.awssdk.services.iam.IamClient; @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-iam", title = "AWS Identity and Access Management (IAM)", syntax = "aws2-iam:label", producerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT }, headersClass = IAM2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: the names, the ARNs and the policy documents come from headers, such" + + " as CamelAwsIAMUsername. With pojoRequest=true the request of the AWS SDK" + + " for the operation, such as a CreateUserRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the CreateUserResponse" + + " of createUser; the create and get operations put the ARN and the id in" + + " headers too")) public class IAM2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private IamClient iamClient; diff --git a/components/camel-aws/camel-aws2-kms/src/generated/resources/META-INF/org/apache/camel/component/aws2/kms/aws2-kms.json b/components/camel-aws/camel-aws2-kms/src/generated/resources/META-INF/org/apache/camel/component/aws2/kms/aws2-kms.json index 4343f5c9c43e..9b34dd2aafd1 100644 --- a/components/camel-aws/camel-aws2-kms/src/generated/resources/META-INF/org/apache/camel/component/aws2/kms/aws2-kms.json +++ b/components/camel-aws/camel-aws2-kms/src/generated/resources/META-INF/org/apache/camel/component/aws2/kms/aws2-kms.json @@ -57,6 +57,10 @@ "CamelAwsKMSKeyState": { "index": 8, "kind": "header", "displayName": "", "group": "createKey describeKey", "label": "createKey describeKey", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The state of the key.", "constantName": "org.apache.camel.component.aws2.kms.KMS2Constants#KEY_STATE" }, "CamelAwsKMSDeletionDate": { "index": 9, "kind": "header", "displayName": "", "group": "scheduleKeyDeletion", "label": "scheduleKeyDeletion", "required": false, "javaType": "java.time.Instant", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The date and time after which AWS KMS deletes the key.", "constantName": "org.apache.camel.component.aws2.kms.KMS2Constants#DELETION_DATE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the key id and the other inputs come from headers, such as CamelAwsKMSKeyId. With pojoRequest=true the request of the AWS SDK for the operation, such as a ListKeysRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the CreateKeyResponse of createKey, which puts the id, the ARN and the state of the key in headers too" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kms.KMS2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.kms.KMS2Operations", "enum": [ "listKeys", "createKey", "disableKey", "scheduleKeyDeletion", "describeKey", "enableKey" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.kms.KMS2Configuration", "configurationFi [...] diff --git a/components/camel-aws/camel-aws2-kms/src/main/java/org/apache/camel/component/aws2/kms/KMS2Endpoint.java b/components/camel-aws/camel-aws2-kms/src/main/java/org/apache/camel/component/aws2/kms/KMS2Endpoint.java index a86db8f420c1..f52a00d64f54 100644 --- a/components/camel-aws/camel-aws2-kms/src/main/java/org/apache/camel/component/aws2/kms/KMS2Endpoint.java +++ b/components/camel-aws/camel-aws2-kms/src/main/java/org/apache/camel/component/aws2/kms/KMS2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.kms.client.KMS2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,15 @@ import software.amazon.awssdk.services.kms.KmsClient; @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-kms", title = "AWS Key Management Service (KMS)", syntax = "aws2-kms:label", producerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT }, headersClass = KMS2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: the key id and the other inputs come from headers, such as" + + " CamelAwsKMSKeyId. With pojoRequest=true the request of the AWS SDK for the" + + " operation, such as a ListKeysRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the CreateKeyResponse" + + " of createKey, which puts the id, the ARN and the state of the key in" + + " headers too")) public class KMS2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private KmsClient kmsClient; diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/resources/META-INF/org/apache/camel/component/aws2/lambda/aws2-lambda.json b/components/camel-aws/camel-aws2-lambda/src/generated/resources/META-INF/org/apache/camel/component/aws2/lambda/aws2-lambda.json index 8489a1167f94..91d53de5ac09 100644 --- a/components/camel-aws/camel-aws2-lambda/src/generated/resources/META-INF/org/apache/camel/component/aws2/lambda/aws2-lambda.json +++ b/components/camel-aws/camel-aws2-lambda/src/generated/resources/META-INF/org/apache/camel/component/aws2/lambda/aws2-lambda.json @@ -105,6 +105,10 @@ "CamelAwsLambdaSourceAccount": { "index": 54, "kind": "header", "displayName": "", "group": "addPermission", "label": "addPermission", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon Web Services account ID of the principal.", "constantName": "org.apache.camel.component.aws2.lambda.Lambda2Constants#SOURCE_ACCOUNT" }, "CamelAwsLambdaSourceArn": { "index": 55, "kind": "header", "displayName": "", "group": "addPermission", "label": "addPermission", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.", "constantName": "org.apache.camel.component.aws2.lambda.Lambda2Constants#SOURCE_ARN" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "dependsOn": [ "operation" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "createFunction", "carriers": [ "bytes", "stream", "file", "null" ] }, { "option": "operation", "value": "updateFunction", "carriers": [ "bytes", "stream", "file", "null" ] } ], "description": "The payload of invokeFunction, the default, [...] + "producerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "dependsOn": [ "operation" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text" ], "javaType": "java.lang.String" } ], "description": "The payload of the response of invokeFunction, the default, as text: the JSON the function returns, or the JSON of its error with the CamelAwsLambdaFunctionError header set, as an error of the function does not fail the exchange. The response [...] + }, "properties": { "function": { "index": 0, "kind": "path", "displayName": "Function", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the Lambda function." }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.lambda.Lambda2Operations", "enum": [ "listFunctions", "getFunction", "createAlias", "deleteAlias", "getAlias", "listAliases", "createFunction", "deleteFunction", "invokeFunction", "updateFunction", "createEventSourceMapping", "deleteEventSourceMapping", "listEventSourceMapping", "listTags", "tagRe [...] diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java index c63b487d61e5..4482af2e4db8 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java @@ -23,6 +23,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.lambda.client.Lambda2ClientFactory; import org.apache.camel.spi.*; +import org.apache.camel.spi.BodyType.Carrier; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.util.ObjectHelper; import software.amazon.awssdk.services.lambda.LambdaClient; @@ -33,6 +34,33 @@ import software.amazon.awssdk.services.lambda.LambdaClient; @UriEndpoint(firstVersion = "3.2.0", scheme = "aws2-lambda", title = "AWS Lambda", syntax = "aws2-lambda:function", producerOnly = true, category = { Category.CLOUD, Category.SERVERLESS }, headersClass = Lambda2Constants.class) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + dependsOn = "operation", + byOption = { + @BodyType.When(option = "operation", value = "invokeFunction", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "operation", value = "createFunction", + carriers = { + Carrier.BYTES, Carrier.STREAM, Carrier.FILE, Carrier.NULL }), + @BodyType.When(option = "operation", value = "updateFunction", + carriers = { + Carrier.BYTES, Carrier.STREAM, Carrier.FILE, Carrier.NULL }) }, + description = "The payload of invokeFunction, the default, as JSON text: bytes, a stream or a" + + " file are read as text, a Map or a POJO is sent as its toString(), so" + + " marshal it first, and no body fails. createFunction and updateFunction take" + + " the zip of the code as bytes, a stream or a file, or no body with the" + + " CamelAwsLambdaZipFile header or the S3 headers. The other operations take" + + " their input from headers, or with pojoRequest=true from the request of the" + + " AWS SDK in the body"), + producerOut = @BodyType(value = Carrier.TEXT, javaType = "java.lang.String", dependsOn = "operation", + byOption = @BodyType.When(option = "operation", value = "invokeFunction", + carriers = Carrier.TEXT, javaType = "java.lang.String"), + description = "The payload of the response of invokeFunction, the default, as text: the JSON" + + " the function returns, or the JSON of its error with the" + + " CamelAwsLambdaFunctionError header set, as an error of the function does" + + " not fail the exchange. The response of the AWS SDK for the other" + + " operations, such as a ListFunctionsResponse")) public class Lambda2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private LambdaClient awsLambdaClient; diff --git a/components/camel-aws/camel-aws2-ses/src/generated/resources/META-INF/org/apache/camel/component/aws2/ses/aws2-ses.json b/components/camel-aws/camel-aws2-ses/src/generated/resources/META-INF/org/apache/camel/component/aws2/ses/aws2-ses.json index fe819d72e0df..5e0a96e16627 100644 --- a/components/camel-aws/camel-aws2-ses/src/generated/resources/META-INF/org/apache/camel/component/aws2/ses/aws2-ses.json +++ b/components/camel-aws/camel-aws2-ses/src/generated/resources/META-INF/org/apache/camel/component/aws2/ses/aws2-ses.json @@ -65,6 +65,10 @@ "CamelAwsSesHtmlEmail": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag to show if email content is HTML.", "constantName": "org.apache.camel.component.aws2.ses.Ses2Constants#HTML_EMAIL" }, "CamelAwsSesConfigurationSet": { "index": 10, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "TThe configuration set to send.", "constantName": "org.apache.camel.component.aws2.ses.Ses2Constants#CONFIGURATION_SET" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text of the mail, or its HTML with the CamelAwsSesHtmlEmail header set to true: bytes, a stream or a file are read as text, and a Map or a POJO is sent as its toString(), so marshal it first. A jakarta.mail Message is sent as a raw mail as it is" }, + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged, with the id of the mail in the CamelAwsSesMessageId header" } + }, "properties": { "from": { "index": 0, "kind": "path", "displayName": "From", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "The sender's email address." }, "bcc": { "index": 1, "kind": "parameter", "displayName": "Bcc", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "List of comma-separated destination blind carbon copy (bcc) email address. Can be overridden with 'CamelAwsSesBcc' header." }, diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java index b918f2e1e952..66833a220a58 100644 --- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java +++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.ses.client.Ses2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,6 +37,13 @@ import software.amazon.awssdk.services.ses.SesClient; */ @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ses", title = "AWS Simple Email Service (SES)", syntax = "aws2-ses:from", producerOnly = true, category = { Category.CLOUD, Category.MAIL }, headersClass = Ses2Constants.class) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + description = "The text of the mail, or its HTML with the CamelAwsSesHtmlEmail header set to" + + " true: bytes, a stream or a file are read as text, and a Map or a POJO is" + + " sent as its toString(), so marshal it first. A jakarta.mail Message is sent" + + " as a raw mail as it is"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + description = "Unchanged, with the id of the mail in the CamelAwsSesMessageId header")) public class Ses2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private SesClient sesClient; diff --git a/components/camel-aws/camel-aws2-sts/src/generated/resources/META-INF/org/apache/camel/component/aws2/sts/aws2-sts.json b/components/camel-aws/camel-aws2-sts/src/generated/resources/META-INF/org/apache/camel/component/aws2/sts/aws2-sts.json index ba45cde1c621..7c8f668b5c00 100644 --- a/components/camel-aws/camel-aws2-sts/src/generated/resources/META-INF/org/apache/camel/component/aws2/sts/aws2-sts.json +++ b/components/camel-aws/camel-aws2-sts/src/generated/resources/META-INF/org/apache/camel/component/aws2/sts/aws2-sts.json @@ -55,6 +55,10 @@ "CamelAwsStsExpiration": { "index": 8, "kind": "header", "displayName": "", "group": "assumeRole getSessionToken getFederationToken", "label": "assumeRole getSessionToken getFederationToken", "required": false, "javaType": "java.time.Instant", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expiration date and time of the credentials.", "constantName": "org.apache.camel.component.aws2.sts.STS2Constants#EXPIRATION" }, "CamelAwsStsAssumedRoleArn": { "index": 9, "kind": "header", "displayName": "", "group": "assumeRole", "label": "assumeRole", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon Resource Name (ARN) of the assumed role.", "constantName": "org.apache.camel.component.aws2.sts.STS2Constants#ASSUMED_ROLE_ARN" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: assumeRole takes the role from the CamelAwsStsRoleArn and CamelAwsStsRoleSessionName headers, and getFederationToken the name from CamelAwsStsFederatedName. With pojoRequest=true the request of the AWS SDK for the operation, such as an AssumeRoleRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the AssumeRoleResponse of assumeRole, the default, with the temporary credentials in credentials()" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sts.STS2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.sts.STS2Operations", "enum": [ "assumeRole", "getSessionToken", "getFederationToken" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "assumeRole", "configurationClass": "org.apache.camel.component.aws2.sts.STS2Configuration", "configurationField": [...] diff --git a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Endpoint.java b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Endpoint.java index 612f5258ef54..23cc3b2b1971 100644 --- a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Endpoint.java +++ b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.sts.client.STS2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -37,6 +40,16 @@ import software.amazon.awssdk.services.sts.StsClient; Category.CLOUD, Category.MANAGEMENT }, headersClass = STS2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: assumeRole takes the role from the CamelAwsStsRoleArn and" + + " CamelAwsStsRoleSessionName headers, and getFederationToken the name from" + + " CamelAwsStsFederatedName. With pojoRequest=true the request of the AWS SDK" + + " for the operation, such as an AssumeRoleRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the AssumeRoleResponse" + + " of assumeRole, the default, with the temporary credentials in" + + " credentials()")) public class STS2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private StsClient stsClient; diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java index 10be33f10128..c9b1180d50c3 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java @@ -1604,6 +1604,133 @@ public class TextBodyFlowTest { .anySatisfy(m -> assertThat(m).contains("route rows: simple reads a field of the body (${body[id]})")); } + @Test + public void testTheBodyOfAwsServices() { + // ses, the secret of createSecret, the payload of invokeFunction and the detail of putEvent are text, and the + // zip of createFunction is bytes, a stream or a file; getSecret and invokeFunction give text, and so does the + // eventbridge consumer; aws2-ddb keeps the body, aws2-iam does not use it, and a ddb stream record is a POJO + String yaml = """ + - route: + id: mail + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-ses:[email protected][email protected] + - route: + id: secret + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws-secrets-manager:vault?operation=createSecret + - route: + id: invoke + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-lambda:greet?operation=invokeFunction + - route: + id: deploy + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-lambda:greet?operation=createFunction + - route: + id: event + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-eventbridge:default?operation=putEvent + - route: + id: lookup + from: + uri: timer:tick + steps: + - to: aws-secrets-manager:vault?operation=getSecret + - setHeader: + name: user + simple: ${body[user]} + - route: + id: answer + from: + uri: timer:tick + steps: + - setBody: + constant: '{"name": "Camel"}' + - to: aws2-lambda:greet?operation=invokeFunction + - setHeader: + name: hello + simple: ${body[Hello]} + - route: + id: events + from: + uri: aws2-eventbridge:default?ruleName=orders + steps: + - setHeader: + name: id + simple: ${body[id]} + - route: + id: table + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-ddb:orders?operation=PutItem + - setHeader: + name: id + simple: ${body[id]} + - route: + id: users + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-iam:iam?operation=listUsers + - route: + id: records + from: + uri: aws2-ddbstream:orders + steps: + - setHeader: + name: id + simple: ${body[id]} + """; + assertThat(lines(yaml)).hasSize(8) + .anySatisfy(m -> assertThat(m).contains("route mail: to: aws2-ses needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route secret: to: aws-secrets-manager needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route invoke: to: aws2-lambda needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route deploy: to: aws2-lambda needs the body as bytes")) + .anySatisfy(m -> assertThat(m).contains("route event: to: aws2-eventbridge needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route lookup: simple reads a field of the body (${body[user]})")) + .anySatisfy(m -> assertThat(m).contains("route answer: simple reads a field of the body (${body[Hello]})")) + .anySatisfy(m -> assertThat(m).contains("route events: simple reads a field of the body (${body[id]})")); + } + @Test public void testAnOptionValueInAnotherStyleOfTheEnum() { // the catalog and the enum type converter take convert-to-json and convertToJson as CONVERT_TO_JSON, so after
