This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new e530614 CAMEL-15938: camel-aws-iam - operation is not always required as parameter. e530614 is described below commit e53061441921f4e9a5cd145f3fe6664dba6fa68d Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Dec 17 15:52:31 2020 +0100 CAMEL-15938: camel-aws-iam - operation is not always required as parameter. --- .../org/apache/camel/catalog/docs/aws2-iam-component.adoc | 4 ++-- .../org/apache/camel/component/aws2/iam/aws2-iam.json | 4 ++-- .../camel-aws2-iam/src/main/docs/aws2-iam-component.adoc | 4 ++-- .../org/apache/camel/component/aws2/iam/IAM2Configuration.java | 6 ++++-- .../java/org/apache/camel/component/aws2/iam/IAM2Producer.java | 9 +++++++-- .../builder/component/dsl/Aws2IamComponentBuilderFactory.java | 4 +++- .../camel/builder/endpoint/dsl/IAM2EndpointBuilderFactory.java | 10 ++++++---- docs/components/modules/ROOT/pages/aws2-iam-component.adoc | 4 ++-- 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-iam-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-iam-component.adoc index ae12b55..ec77ba0 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-iam-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-iam-component.adoc @@ -52,7 +52,7 @@ The AWS 2 Identity and Access Management (IAM) component supports 13 options, wh | *configuration* (producer) | Component configuration | | IAM2Configuration | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer @@ -95,7 +95,7 @@ with the following path and query parameters: | Name | Description | Default | Type | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer diff --git a/components/camel-aws2-iam/src/generated/resources/org/apache/camel/component/aws2/iam/aws2-iam.json b/components/camel-aws2-iam/src/generated/resources/org/apache/camel/component/aws2/iam/aws2-iam.json index b6877d3..b40879c 100644 --- a/components/camel-aws2-iam/src/generated/resources/org/apache/camel/component/aws2/iam/aws2-iam.json +++ b/components/camel-aws2-iam/src/generated/resources/org/apache/camel/component/aws2/iam/aws2-iam.json @@ -25,7 +25,7 @@ "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.iam.IAM2Configuration", "deprecated": false, "autowired": false, "secret": false, "description": "Component configuration" }, "iamClient": { "kind": "property", "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 a existing configured AWS IAM as client" }, "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] - "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.iam.IAM2Operations", "enum": [ "listAccessKeys", "createUser", "deleteUser", "getUser", "listUsers", "createAccessKey", "deleteAccessKey", "updateAccessKey", "createGroup", "deleteGroup", "listGroups", "addUserToGroup", "removeUserFromGroup" ], "deprecated": false, "deprecationNote": "", "autowired": false, " [...] + "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.iam.IAM2Operations", "enum": [ "listAccessKeys", "createUser", "deleteUser", "getUser", "listUsers", "createAccessKey", "deleteAccessKey", "updateAccessKey", "createGroup", "deleteGroup", "listGroups", "addUserToGroup", "removeUserFromGroup" ], "deprecated": false, "autowired": false, "secret": false, "confi [...] "pojoRequest": { "kind": "property", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the IAM client" }, "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the IAM client" }, @@ -40,7 +40,7 @@ "label": { "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": { "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 a existing configured AWS IAM as client" }, "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] - "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.iam.IAM2Operations", "enum": [ "listAccessKeys", "createUser", "deleteUser", "getUser", "listUsers", "createAccessKey", "deleteAccessKey", "updateAccessKey", "createGroup", "deleteGroup", "listGroups", "addUserToGroup", "removeUserFromGroup" ], "deprecated": false, "deprecationNote": "", "autowired": false, [...] + "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.iam.IAM2Operations", "enum": [ "listAccessKeys", "createUser", "deleteUser", "getUser", "listUsers", "createAccessKey", "deleteAccessKey", "updateAccessKey", "createGroup", "deleteGroup", "listGroups", "addUserToGroup", "removeUserFromGroup" ], "deprecated": false, "autowired": false, "secret": false, "conf [...] "pojoRequest": { "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the IAM client" }, "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.iam.IAM2Configuration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the IAM client" }, diff --git a/components/camel-aws2-iam/src/main/docs/aws2-iam-component.adoc b/components/camel-aws2-iam/src/main/docs/aws2-iam-component.adoc index ae12b55..ec77ba0 100644 --- a/components/camel-aws2-iam/src/main/docs/aws2-iam-component.adoc +++ b/components/camel-aws2-iam/src/main/docs/aws2-iam-component.adoc @@ -52,7 +52,7 @@ The AWS 2 Identity and Access Management (IAM) component supports 13 options, wh | *configuration* (producer) | Component configuration | | IAM2Configuration | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer @@ -95,7 +95,7 @@ with the following path and query parameters: | Name | Description | Default | Type | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer diff --git a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Configuration.java b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Configuration.java index afd0c30..c0ea361 100644 --- a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Configuration.java +++ b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Configuration.java @@ -39,7 +39,6 @@ public class IAM2Configuration implements Cloneable { @UriParam(label = "security", secret = true) private String secretKey; @UriParam - @Metadata(required = true) private IAM2Operations operation; @UriParam(enums = "HTTP,HTTPS", defaultValue = "HTTPS") private Protocol proxyProtocol = Protocol.HTTPS; @@ -92,7 +91,10 @@ public class IAM2Configuration implements Cloneable { } /** - * The operation to perform + * The operation to perform. + * + * You can configure a default operation on the component level, or the operation as part of the endpoint, or via a + * message header with the key CamelAwsIAMOperation. */ public void setOperation(IAM2Operations operation) { this.operation = operation; diff --git a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Producer.java b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Producer.java index 80dbe7f..f6040ff 100644 --- a/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Producer.java +++ b/components/camel-aws2-iam/src/main/java/org/apache/camel/component/aws2/iam/IAM2Producer.java @@ -69,7 +69,12 @@ public class IAM2Producer extends DefaultProducer { @Override public void process(Exchange exchange) throws Exception { - switch (determineOperation(exchange)) { + IAM2Operations operation = determineOperation(exchange); + if (operation == null) { + throw new IllegalArgumentException("Operation must be provided"); + } + + switch (operation) { case listAccessKeys: listAccessKeys(getEndpoint().getIamClient(), exchange); break; @@ -110,7 +115,7 @@ public class IAM2Producer extends DefaultProducer { removeUserFromGroup(getEndpoint().getIamClient(), exchange); break; default: - throw new IllegalArgumentException("Unsupported operation"); + throw new IllegalArgumentException("Unsupported operation: " + operation); } } diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2IamComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2IamComponentBuilderFactory.java index c776f9f..d2358d4a 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2IamComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2IamComponentBuilderFactory.java @@ -105,7 +105,9 @@ public interface Aws2IamComponentBuilderFactory { return this; } /** - * The operation to perform. + * The operation to perform. You can configure a default operation on + * the component level, or the operation as part of the endpoint, or via + * a message header with the key CamelAwsIAMOperation. * * The option is a: * <code>org.apache.camel.component.aws2.iam.IAM2Operations</code> type. diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/IAM2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/IAM2EndpointBuilderFactory.java index ac2dd5e..17eb1e0 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/IAM2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/IAM2EndpointBuilderFactory.java @@ -116,12 +116,13 @@ public interface IAM2EndpointBuilderFactory { return this; } /** - * The operation to perform. + * The operation to perform. You can configure a default operation on + * the component level, or the operation as part of the endpoint, or via + * a message header with the key CamelAwsIAMOperation. * * The option is a: * <code>org.apache.camel.component.aws2.iam.IAM2Operations</code> type. * - * Required: true * Group: producer * * @param operation the value to set @@ -132,12 +133,13 @@ public interface IAM2EndpointBuilderFactory { return this; } /** - * The operation to perform. + * The operation to perform. You can configure a default operation on + * the component level, or the operation as part of the endpoint, or via + * a message header with the key CamelAwsIAMOperation. * * The option will be converted to a * <code>org.apache.camel.component.aws2.iam.IAM2Operations</code> type. * - * Required: true * Group: producer * * @param operation the value to set diff --git a/docs/components/modules/ROOT/pages/aws2-iam-component.adoc b/docs/components/modules/ROOT/pages/aws2-iam-component.adoc index 796ee04..4e75607 100644 --- a/docs/components/modules/ROOT/pages/aws2-iam-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-iam-component.adoc @@ -54,7 +54,7 @@ The AWS 2 Identity and Access Management (IAM) component supports 13 options, wh | *configuration* (producer) | Component configuration | | IAM2Configuration | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer @@ -97,7 +97,7 @@ with the following path and query parameters: | Name | Description | Default | Type | *iamClient* (producer) | *Autowired* To use a existing configured AWS IAM as client | | IamClient | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *operation* (producer) | *Required* The operation to perform. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations +| *operation* (producer) | The operation to perform. You can configure a default operation on the component level, or the operation as part of the endpoint, or via a message header with the key CamelAwsIAMOperation. There are 13 enums and the value can be one of: listAccessKeys, createUser, deleteUser, getUser, listUsers, createAccessKey, deleteAccessKey, updateAccessKey, createGroup, deleteGroup, listGroups, addUserToGroup, removeUserFromGroup | | IAM2Operations | *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *proxyHost* (producer) | To define a proxy host when instantiating the IAM client | | String | *proxyPort* (producer) | To define a proxy port when instantiating the IAM client | | Integer