This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 5a4421ab9f9 CAMEL-20678: camel-google-sheets - Error setting scopes parameter (#13817) 5a4421ab9f9 is described below commit 5a4421ab9f9dff2b083e676a07e12063d3376a4a Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Apr 16 12:11:26 2024 +0200 CAMEL-20678: camel-google-sheets - Error setting scopes parameter (#13817) * CAMEL-20678: camel-google-sheets - Error setting scopes parameter * CAMEL-20678: camel-google-sheets - Error setting scopes parameter --- .../camel/catalog/components/google-sheets.json | 4 +- .../sheets/GoogleSheetsComponentConfigurer.java | 14 +---- .../GoogleSheetsConfigurationConfigurer.java | 14 +---- .../sheets/GoogleSheetsEndpointConfigurer.java | 7 +-- ...preadsheetsEndpointConfigurationConfigurer.java | 14 +---- ...heetsValuesEndpointConfigurationConfigurer.java | 14 +---- .../component/google/sheets/google-sheets.json | 4 +- .../google/sheets/GoogleSheetsComponent.java | 4 +- .../google/sheets/GoogleSheetsConfiguration.java | 18 ++++-- .../sheets/GoogleSheetsVerifierExtension.java | 2 +- .../ROOT/pages/camel-4x-upgrade-guide-4_6.adoc | 5 ++ .../dsl/GoogleSheetsComponentBuilderFactory.java | 10 ++- .../dsl/GoogleSheetsEndpointBuilderFactory.java | 72 ++-------------------- .../camel/kotlin/components/GoogleSheetsUriDsl.kt | 3 +- 14 files changed, 53 insertions(+), 132 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json index bbb761c4227..357cd079ac0 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json @@ -29,7 +29,7 @@ "clientId": { "index": 1, "kind": "property", "displayName": "Client Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Client ID of the sheets application" }, "configuration": { "index": 2, "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "To use the shared configuration" }, "delegate": { "index": 3, "kind": "property", "displayName": "Delegate", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Delegate for wide-domain service account" }, - "scopes": { "index": 4, "kind": "property", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "array", "javaType": "java.util.Collection<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. [...] + "scopes": { "index": 4, "kind": "property", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. See https:\/\/develop [...] "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "splitResult": { "index": 6, "kind": "property", "displayName": "Split Result", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "When consumer return an array or collection this will generate one exchange pe [...] "lazyStartProducer": { "index": 7, "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 [...] @@ -47,7 +47,7 @@ "clientId": { "index": 3, "kind": "parameter", "displayName": "Client Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Client ID of the sheets application" }, "delegate": { "index": 4, "kind": "parameter", "displayName": "Delegate", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Delegate for wide-domain service account" }, "inBody": { "index": 5, "kind": "parameter", "displayName": "In Body", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the name of a parameter to be passed in the exchange In Body" }, - "scopes": { "index": 6, "kind": "parameter", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "array", "javaType": "java.util.Collection<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. [...] + "scopes": { "index": 6, "kind": "parameter", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. See https:\/\/develo [...] "sendEmptyMessageWhenIdle": { "index": 7, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "splitResult": { "index": 8, "kind": "parameter", "displayName": "Split Result", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "When consumer return an array or collection this will generate one exchange p [...] "bridgeErrorHandler": { "index": 9, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] diff --git a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsComponentConfigurer.java b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsComponentConfigurer.java index 49406f36e39..bbe70f177f6 100644 --- a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsComponentConfigurer.java +++ b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsComponentConfigurer.java @@ -24,7 +24,7 @@ public class GoogleSheetsComponentConfigurer extends PropertyConfigurerSupport i map.put("clientId", java.lang.String.class); map.put("configuration", org.apache.camel.component.google.sheets.GoogleSheetsConfiguration.class); map.put("delegate", java.lang.String.class); - map.put("scopes", java.util.Collection.class); + map.put("scopes", java.lang.String.class); map.put("bridgeErrorHandler", boolean.class); map.put("splitResult", boolean.class); map.put("lazyStartProducer", boolean.class); @@ -68,7 +68,7 @@ public class GoogleSheetsComponentConfigurer extends PropertyConfigurerSupport i case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "refreshtoken": case "refreshToken": getOrCreateConfiguration(target).setRefreshToken(property(camelContext, java.lang.String.class, value)); return true; - case "scopes": getOrCreateConfiguration(target).setScopes(property(camelContext, java.util.Collection.class, value)); return true; + case "scopes": getOrCreateConfiguration(target).setScopes(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": getOrCreateConfiguration(target).setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "splitresult": @@ -105,7 +105,7 @@ public class GoogleSheetsComponentConfigurer extends PropertyConfigurerSupport i case "lazyStartProducer": return boolean.class; case "refreshtoken": case "refreshToken": return java.lang.String.class; - case "scopes": return java.util.Collection.class; + case "scopes": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; case "splitresult": @@ -146,13 +146,5 @@ public class GoogleSheetsComponentConfigurer extends PropertyConfigurerSupport i default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "scopes": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsConfigurationConfigurer.java b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsConfigurationConfigurer.java index ec2f19291fd..83460ce7290 100644 --- a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsConfigurationConfigurer.java +++ b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsConfigurationConfigurer.java @@ -28,7 +28,7 @@ public class GoogleSheetsConfigurationConfigurer extends org.apache.camel.suppor map.put("Delegate", java.lang.String.class); map.put("MethodName", java.lang.String.class); map.put("RefreshToken", java.lang.String.class); - map.put("Scopes", java.util.Collection.class); + map.put("Scopes", java.lang.String.class); map.put("ServiceAccountKey", java.lang.String.class); map.put("SplitResult", boolean.class); ALL_OPTIONS = map; @@ -53,7 +53,7 @@ public class GoogleSheetsConfigurationConfigurer extends org.apache.camel.suppor case "methodName": target.setMethodName(property(camelContext, java.lang.String.class, value)); return true; case "refreshtoken": case "refreshToken": target.setRefreshToken(property(camelContext, java.lang.String.class, value)); return true; - case "scopes": target.setScopes(property(camelContext, java.util.Collection.class, value)); return true; + case "scopes": target.setScopes(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "splitresult": @@ -85,7 +85,7 @@ public class GoogleSheetsConfigurationConfigurer extends org.apache.camel.suppor case "methodName": return java.lang.String.class; case "refreshtoken": case "refreshToken": return java.lang.String.class; - case "scopes": return java.util.Collection.class; + case "scopes": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; case "splitresult": @@ -121,13 +121,5 @@ public class GoogleSheetsConfigurationConfigurer extends org.apache.camel.suppor default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "scopes": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpointConfigurer.java b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpointConfigurer.java index 1ca70ae9ba6..aa10c9bb85b 100644 --- a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpointConfigurer.java +++ b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpointConfigurer.java @@ -26,7 +26,7 @@ public class GoogleSheetsEndpointConfigurer extends PropertyConfigurerSupport im map.put("clientId", java.lang.String.class); map.put("delegate", java.lang.String.class); map.put("inBody", java.lang.String.class); - map.put("scopes", java.util.Collection.class); + map.put("scopes", java.lang.String.class); map.put("sendEmptyMessageWhenIdle", boolean.class); map.put("splitResult", boolean.class); map.put("bridgeErrorHandler", boolean.class); @@ -101,7 +101,7 @@ public class GoogleSheetsEndpointConfigurer extends PropertyConfigurerSupport im case "scheduler": target.setScheduler(property(camelContext, java.lang.Object.class, value)); return true; case "schedulerproperties": case "schedulerProperties": target.setSchedulerProperties(property(camelContext, java.util.Map.class, value)); return true; - case "scopes": target.getConfiguration().setScopes(property(camelContext, java.util.Collection.class, value)); return true; + case "scopes": target.getConfiguration().setScopes(property(camelContext, java.lang.String.class, value)); return true; case "sendemptymessagewhenidle": case "sendEmptyMessageWhenIdle": target.setSendEmptyMessageWhenIdle(property(camelContext, boolean.class, value)); return true; case "serviceaccountkey": @@ -168,7 +168,7 @@ public class GoogleSheetsEndpointConfigurer extends PropertyConfigurerSupport im case "scheduler": return java.lang.Object.class; case "schedulerproperties": case "schedulerProperties": return java.util.Map.class; - case "scopes": return java.util.Collection.class; + case "scopes": return java.lang.String.class; case "sendemptymessagewhenidle": case "sendEmptyMessageWhenIdle": return boolean.class; case "serviceaccountkey": @@ -253,7 +253,6 @@ public class GoogleSheetsEndpointConfigurer extends PropertyConfigurerSupport im switch (ignoreCase ? name.toLowerCase() : name) { case "schedulerproperties": case "schedulerProperties": return java.lang.Object.class; - case "scopes": return java.lang.String.class; default: return null; } } diff --git a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfigurationConfigurer.java b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfigurationConfigurer.java index d322bf300bf..a4326fc1968 100644 --- a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfigurationConfigurer.java +++ b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfigurationConfigurer.java @@ -31,7 +31,7 @@ public class SheetsSpreadsheetsEndpointConfigurationConfigurer extends org.apach map.put("GetSpreadsheetByDataFilterRequest", com.google.api.services.sheets.v4.model.GetSpreadsheetByDataFilterRequest.class); map.put("MethodName", java.lang.String.class); map.put("RefreshToken", java.lang.String.class); - map.put("Scopes", java.util.Collection.class); + map.put("Scopes", java.lang.String.class); map.put("ServiceAccountKey", java.lang.String.class); map.put("SplitResult", boolean.class); map.put("SpreadsheetId", java.lang.String.class); @@ -62,7 +62,7 @@ public class SheetsSpreadsheetsEndpointConfigurationConfigurer extends org.apach case "methodName": target.setMethodName(property(camelContext, java.lang.String.class, value)); return true; case "refreshtoken": case "refreshToken": target.setRefreshToken(property(camelContext, java.lang.String.class, value)); return true; - case "scopes": target.setScopes(property(camelContext, java.util.Collection.class, value)); return true; + case "scopes": target.setScopes(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "splitresult": @@ -101,7 +101,7 @@ public class SheetsSpreadsheetsEndpointConfigurationConfigurer extends org.apach case "methodName": return java.lang.String.class; case "refreshtoken": case "refreshToken": return java.lang.String.class; - case "scopes": return java.util.Collection.class; + case "scopes": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; case "splitresult": @@ -146,13 +146,5 @@ public class SheetsSpreadsheetsEndpointConfigurationConfigurer extends org.apach default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "scopes": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsValuesEndpointConfigurationConfigurer.java b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsValuesEndpointConfigurationConfigurer.java index bb6cffef6b0..6425f9ffc07 100644 --- a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsValuesEndpointConfigurationConfigurer.java +++ b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsValuesEndpointConfigurationConfigurer.java @@ -35,7 +35,7 @@ public class SheetsSpreadsheetsValuesEndpointConfigurationConfigurer extends org map.put("MethodName", java.lang.String.class); map.put("Range", java.lang.String.class); map.put("RefreshToken", java.lang.String.class); - map.put("Scopes", java.util.Collection.class); + map.put("Scopes", java.lang.String.class); map.put("ServiceAccountKey", java.lang.String.class); map.put("SplitResult", boolean.class); map.put("SpreadsheetId", java.lang.String.class); @@ -74,7 +74,7 @@ public class SheetsSpreadsheetsValuesEndpointConfigurationConfigurer extends org case "range": target.setRange(property(camelContext, java.lang.String.class, value)); return true; case "refreshtoken": case "refreshToken": target.setRefreshToken(property(camelContext, java.lang.String.class, value)); return true; - case "scopes": target.setScopes(property(camelContext, java.util.Collection.class, value)); return true; + case "scopes": target.setScopes(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; case "splitresult": @@ -121,7 +121,7 @@ public class SheetsSpreadsheetsValuesEndpointConfigurationConfigurer extends org case "range": return java.lang.String.class; case "refreshtoken": case "refreshToken": return java.lang.String.class; - case "scopes": return java.util.Collection.class; + case "scopes": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; case "splitresult": @@ -175,13 +175,5 @@ public class SheetsSpreadsheetsValuesEndpointConfigurationConfigurer extends org default: return null; } } - - @Override - public Object getCollectionValueType(Object target, String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "scopes": return java.lang.String.class; - default: return null; - } - } } diff --git a/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json b/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json index bbb761c4227..357cd079ac0 100644 --- a/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json +++ b/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json @@ -29,7 +29,7 @@ "clientId": { "index": 1, "kind": "property", "displayName": "Client Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Client ID of the sheets application" }, "configuration": { "index": 2, "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "To use the shared configuration" }, "delegate": { "index": 3, "kind": "property", "displayName": "Delegate", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Delegate for wide-domain service account" }, - "scopes": { "index": 4, "kind": "property", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "array", "javaType": "java.util.Collection<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. [...] + "scopes": { "index": 4, "kind": "property", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. See https:\/\/develop [...] "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] "splitResult": { "index": 6, "kind": "property", "displayName": "Split Result", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "When consumer return an array or collection this will generate one exchange pe [...] "lazyStartProducer": { "index": 7, "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 [...] @@ -47,7 +47,7 @@ "clientId": { "index": 3, "kind": "parameter", "displayName": "Client Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Client ID of the sheets application" }, "delegate": { "index": 4, "kind": "parameter", "displayName": "Delegate", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Delegate for wide-domain service account" }, "inBody": { "index": 5, "kind": "parameter", "displayName": "In Body", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the name of a parameter to be passed in the exchange In Body" }, - "scopes": { "index": 6, "kind": "parameter", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "array", "javaType": "java.util.Collection<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. [...] + "scopes": { "index": 6, "kind": "parameter", "displayName": "Scopes", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "Specifies the level of permissions you want a sheets application to have to a user account. See https:\/\/develo [...] "sendEmptyMessageWhenIdle": { "index": 7, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "splitResult": { "index": 8, "kind": "parameter", "displayName": "Split Result", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.sheets.GoogleSheetsConfiguration", "configurationField": "configuration", "description": "When consumer return an array or collection this will generate one exchange p [...] "bridgeErrorHandler": { "index": 9, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] diff --git a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsComponent.java b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsComponent.java index 3445b553f8c..e922da901f4 100644 --- a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsComponent.java +++ b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsComponent.java @@ -57,11 +57,11 @@ public class GoogleSheetsComponent if (config.getClientId() != null && !config.getClientId().isBlank() && config.getClientSecret() != null && !config.getClientSecret().isBlank()) { client = getClientFactory().makeClient(config.getClientId(), - config.getClientSecret(), config.getScopes(), + config.getClientSecret(), config.getScopesAsList(), config.getApplicationName(), config.getRefreshToken(), config.getAccessToken()); } else if (config.getServiceAccountKey() != null && !config.getServiceAccountKey().isBlank()) { client = getClientFactory().makeClient(getCamelContext(), config.getServiceAccountKey(), - config.getScopes(), config.getApplicationName(), config.getDelegate()); + config.getScopesAsList(), config.getApplicationName(), config.getDelegate()); } else { throw new IllegalArgumentException( "(clientId and clientSecret) or serviceAccountKey are required to create Google Sheets client"); diff --git a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java index 4ed962c793c..eb2db1f9be1 100644 --- a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java +++ b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java @@ -17,6 +17,7 @@ package org.apache.camel.component.google.sheets; import java.util.Collection; +import java.util.List; import org.apache.camel.component.google.sheets.internal.GoogleSheetsApiName; import org.apache.camel.spi.Configurer; @@ -50,7 +51,7 @@ public class GoogleSheetsConfiguration extends AbstractApiConfiguration { @UriParam private String applicationName; @UriParam - private Collection<String> scopes; + private String scopes; /* Service account */ @UriParam(label = "security") private String serviceAccountKey; @@ -135,17 +136,26 @@ public class GoogleSheetsConfiguration extends AbstractApiConfiguration { this.applicationName = applicationName; } - public Collection<String> getScopes() { + public String getScopes() { return scopes; } + public Collection<String> getScopesAsList() { + if (scopes != null) { + return List.of(scopes.split(",")); + } else { + return null; + } + } + /** * Specifies the level of permissions you want a sheets application to have to a user account. See - * https://developers.google.com/identity/protocols/googlescopes for more info. + * https://developers.google.com/identity/protocols/googlescopes for more info. Multiple scopes can be separated by + * comma. * * @see com.google.api.services.sheets.v4.SheetsScopes */ - public void setScopes(Collection<String> scopes) { + public void setScopes(String scopes) { this.scopes = scopes; } diff --git a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsVerifierExtension.java b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsVerifierExtension.java index e36aafc9ecb..dec69a38564 100644 --- a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsVerifierExtension.java +++ b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsVerifierExtension.java @@ -64,7 +64,7 @@ public class GoogleSheetsVerifierExtension extends DefaultComponentVerifierExten GoogleSheetsConfiguration configuration = setProperties(new GoogleSheetsConfiguration(), parameters); GoogleSheetsClientFactory clientFactory = new BatchGoogleSheetsClientFactory(); Sheets client = clientFactory.makeClient(configuration.getClientId(), configuration.getClientSecret(), - configuration.getScopes(), configuration.getApplicationName(), + configuration.getScopesAsList(), configuration.getApplicationName(), configuration.getRefreshToken(), configuration.getAccessToken()); client.spreadsheets().get(Optional.ofNullable(parameters.get("spreadsheetId")) .map(Object::toString) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc index 19b51c32652..2a242b095bb 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc @@ -67,6 +67,11 @@ instead of `org.apache.camel.Consumer`. The id used for multipart file upload attachments on `AttachmentMessage` has changed from being the name of the uploaded file, to the value specifed on the `name` field of the `Content-Disposition` header sent in the request body. +=== camel-google-sheets + +The option `scopes` is changed from a `Collection` to be a `String` type to make it easy to configure in endpoint URI from all DSLs and tooling. +Multiple scopes can be separated by comma. + === camel-kafka The Kafka component now supports custom subscription adapters for applications with very complex subscription logic. diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleSheetsComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleSheetsComponentBuilderFactory.java index 7e507c11c65..ea319b86c3c 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleSheetsComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleSheetsComponentBuilderFactory.java @@ -114,18 +114,16 @@ public interface GoogleSheetsComponentBuilderFactory { * Specifies the level of permissions you want a sheets application to * have to a user account. See * https://developers.google.com/identity/protocols/googlescopes for - * more info. + * more info. Multiple scopes can be separated by comma. * - * The option is a: - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param scopes the value to set * @return the dsl builder */ - default GoogleSheetsComponentBuilder scopes( - java.util.Collection<java.lang.String> scopes) { + default GoogleSheetsComponentBuilder scopes(java.lang.String scopes) { doSetProperty("scopes", scopes); return this; } @@ -327,7 +325,7 @@ public interface GoogleSheetsComponentBuilderFactory { case "clientId": getOrCreateConfiguration((GoogleSheetsComponent) component).setClientId((java.lang.String) value); return true; case "configuration": ((GoogleSheetsComponent) component).setConfiguration((org.apache.camel.component.google.sheets.GoogleSheetsConfiguration) value); return true; case "delegate": getOrCreateConfiguration((GoogleSheetsComponent) component).setDelegate((java.lang.String) value); return true; - case "scopes": getOrCreateConfiguration((GoogleSheetsComponent) component).setScopes((java.util.Collection) value); return true; + case "scopes": getOrCreateConfiguration((GoogleSheetsComponent) component).setScopes((java.lang.String) value); return true; case "bridgeErrorHandler": ((GoogleSheetsComponent) component).setBridgeErrorHandler((boolean) value); return true; case "splitResult": getOrCreateConfiguration((GoogleSheetsComponent) component).setSplitResult((boolean) value); return true; case "lazyStartProducer": ((GoogleSheetsComponent) component).setLazyStartProducer((boolean) value); return true; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java index 0b925515269..6ff4627031c 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java @@ -106,29 +106,9 @@ public interface GoogleSheetsEndpointBuilderFactory { * Specifies the level of permissions you want a sheets application to * have to a user account. See * https://developers.google.com/identity/protocols/googlescopes for - * more info. + * more info. Multiple scopes can be separated by comma. * - * The option is a: - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. - * - * Group: common - * - * @param scopes the value to set - * @return the dsl builder - */ - default GoogleSheetsEndpointConsumerBuilder scopes( - Collection<java.lang.String> scopes) { - doSetProperty("scopes", scopes); - return this; - } - /** - * Specifies the level of permissions you want a sheets application to - * have to a user account. See - * https://developers.google.com/identity/protocols/googlescopes for - * more info. - * - * The option will be converted to a - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -1004,29 +984,9 @@ public interface GoogleSheetsEndpointBuilderFactory { * Specifies the level of permissions you want a sheets application to * have to a user account. See * https://developers.google.com/identity/protocols/googlescopes for - * more info. + * more info. Multiple scopes can be separated by comma. * - * The option is a: - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. - * - * Group: common - * - * @param scopes the value to set - * @return the dsl builder - */ - default GoogleSheetsEndpointProducerBuilder scopes( - Collection<java.lang.String> scopes) { - doSetProperty("scopes", scopes); - return this; - } - /** - * Specifies the level of permissions you want a sheets application to - * have to a user account. See - * https://developers.google.com/identity/protocols/googlescopes for - * more info. - * - * The option will be converted to a - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * @@ -1234,29 +1194,9 @@ public interface GoogleSheetsEndpointBuilderFactory { * Specifies the level of permissions you want a sheets application to * have to a user account. See * https://developers.google.com/identity/protocols/googlescopes for - * more info. - * - * The option is a: - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. + * more info. Multiple scopes can be separated by comma. * - * Group: common - * - * @param scopes the value to set - * @return the dsl builder - */ - default GoogleSheetsEndpointBuilder scopes( - Collection<java.lang.String> scopes) { - doSetProperty("scopes", scopes); - return this; - } - /** - * Specifies the level of permissions you want a sheets application to - * have to a user account. See - * https://developers.google.com/identity/protocols/googlescopes for - * more info. - * - * The option will be converted to a - * <code>java.util.Collection&lt;java.lang.String&gt;</code> type. + * The option is a: <code>java.lang.String</code> type. * * Group: common * diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/GoogleSheetsUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/GoogleSheetsUriDsl.kt index 80657216d55..e129aed2b69 100644 --- a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/GoogleSheetsUriDsl.kt +++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/GoogleSheetsUriDsl.kt @@ -91,7 +91,8 @@ public class GoogleSheetsUriDsl( /** * Specifies the level of permissions you want a sheets application to have to a user account. See - * https://developers.google.com/identity/protocols/googlescopes for more info. + * https://developers.google.com/identity/protocols/googlescopes for more info. Multiple scopes can + * be separated by comma. */ public fun scopes(scopes: String) { it.property("scopes", scopes)