From 3198af04a3eb32c9aaea8ba2ee00ccac0d8fed1a Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Tue, 1 Jun 2021 10:43:05 +0200 Subject: [PATCH] refactor(example): resource run option --- ...e.groovy => config-configmap-route.groovy} | 2 +- examples/user-config/config-file-route.groovy | 6 ++--- ...oute.groovy => config-secret-route.groovy} | 2 +- .../resource-configmap-route.groovy | 27 +++++++++++++++++++ ...resource-file-base64-encoded-route.groovy} | 2 +- ...oovy => resource-file-binary-route.groovy} | 2 +- ...oute.groovy => resource-file-route.groovy} | 4 +-- .../user-config/resource-secret-route.groovy | 27 +++++++++++++++++++ 8 files changed, 63 insertions(+), 9 deletions(-) rename examples/user-config/{configmap-route.groovy => config-configmap-route.groovy} (93%) rename examples/user-config/{secret-route.groovy => config-secret-route.groovy} (94%) create mode 100644 examples/user-config/resource-configmap-route.groovy rename examples/user-config/{resources-base64-encoded-route.groovy => resource-file-base64-encoded-route.groovy} (96%) rename examples/user-config/{resources-binary-route.groovy => resource-file-binary-route.groovy} (91%) rename examples/user-config/{resources-route.groovy => resource-file-route.groovy} (83%) create mode 100644 examples/user-config/resource-secret-route.groovy diff --git a/examples/user-config/configmap-route.groovy b/examples/user-config/config-configmap-route.groovy similarity index 93% rename from examples/user-config/configmap-route.groovy rename to examples/user-config/config-configmap-route.groovy index 948cb1504d..97653b832b 100644 --- a/examples/user-config/configmap-route.groovy +++ b/examples/user-config/config-configmap-route.groovy @@ -20,7 +20,7 @@ // To run this integrations use: // // kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" -// kamel run --config configmap:my-cm configmap-route.groovy --dev +// kamel run --config configmap:my-cm config-configmap-route.groovy --dev // from('timer:configmap') diff --git a/examples/user-config/config-file-route.groovy b/examples/user-config/config-file-route.groovy index 53b347f6de..e899acde4c 100644 --- a/examples/user-config/config-file-route.groovy +++ b/examples/user-config/config-file-route.groovy @@ -18,11 +18,11 @@ // // To run this integrations use: -// kamel run --config file:resources-data.txt resources-route.groovy --dev +// kamel run --config file:resources-data.txt config-file-route.groovy --dev // -from('timer:resources') - .routeId('resources') +from('timer:config-file') + .routeId('config-file') .setBody() .simple("resource:classpath:resources-data.txt") .log('resource file content is: ${body}') diff --git a/examples/user-config/secret-route.groovy b/examples/user-config/config-secret-route.groovy similarity index 94% rename from examples/user-config/secret-route.groovy rename to examples/user-config/config-secret-route.groovy index 7027b84424..178bb8ee63 100644 --- a/examples/user-config/secret-route.groovy +++ b/examples/user-config/config-secret-route.groovy @@ -20,7 +20,7 @@ // To run this integrations use: // // kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" -// kamel run --config secret:my-sec secret-route.groovy --dev +// kamel run --config secret:my-sec config-secret-route.groovy --dev // from('timer:secret') diff --git a/examples/user-config/resource-configmap-route.groovy b/examples/user-config/resource-configmap-route.groovy new file mode 100644 index 0000000000..1d7ef24136 --- /dev/null +++ b/examples/user-config/resource-configmap-route.groovy @@ -0,0 +1,27 @@ +// camel-k: language=groovy +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// To run this integrations use: +// +// kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" +// kamel run --resource configmap:my-cm resource-configmap-route.groovy --dev +// + +from('file:/etc/camel/data/configmaps/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false') + .log('resource file content is: ${body}') diff --git a/examples/user-config/resources-base64-encoded-route.groovy b/examples/user-config/resource-file-base64-encoded-route.groovy similarity index 96% rename from examples/user-config/resources-base64-encoded-route.groovy rename to examples/user-config/resource-file-base64-encoded-route.groovy index 02559f0bf8..281d6ad350 100644 --- a/examples/user-config/resources-base64-encoded-route.groovy +++ b/examples/user-config/resource-file-base64-encoded-route.groovy @@ -18,7 +18,7 @@ // // To run this integrations use: -// kamel run --resource resources-data.txt --compression=true resources-base64-encoded-route.groovy --dev +// kamel run --resource resources-data.txt --compression=true resource-file-base64-encoded-route.groovy --dev // from('timer:resources-bas64') diff --git a/examples/user-config/resources-binary-route.groovy b/examples/user-config/resource-file-binary-route.groovy similarity index 91% rename from examples/user-config/resources-binary-route.groovy rename to examples/user-config/resource-file-binary-route.groovy index 8b0878bf97..eef04d1336 100644 --- a/examples/user-config/resources-binary-route.groovy +++ b/examples/user-config/resource-file-binary-route.groovy @@ -18,7 +18,7 @@ // // To run this integrations use: -// kamel run --resource resources-data.zip resources-binary-route.groovy -d camel-zipfile --dev +// kamel run --resource resources-data.zip resource-file-binary-route.groovy -d camel-zipfile --dev // from('file:/etc/camel/resources/?fileName=resources-data.zip&noop=true&idempotent=false') diff --git a/examples/user-config/resources-route.groovy b/examples/user-config/resource-file-route.groovy similarity index 83% rename from examples/user-config/resources-route.groovy rename to examples/user-config/resource-file-route.groovy index 1085840562..f39f4e59e3 100644 --- a/examples/user-config/resources-route.groovy +++ b/examples/user-config/resource-file-route.groovy @@ -18,8 +18,8 @@ // // To run this integrations use: -// kamel run --resource resources-data.txt resources-route.groovy --dev +// kamel run --resource file:resources-data.txt resource-file-route.groovy --dev // -from('file:/etc/camel/resources/?fileName=resources-data.txt&noop=true&idempotent=false') +from('file:/etc/camel/data/resources/?fileName=resources-data.txt&noop=true&idempotent=false') .log('resource file content is: ${body}') diff --git a/examples/user-config/resource-secret-route.groovy b/examples/user-config/resource-secret-route.groovy new file mode 100644 index 0000000000..b46bb494f7 --- /dev/null +++ b/examples/user-config/resource-secret-route.groovy @@ -0,0 +1,27 @@ +// camel-k: language=groovy +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// To run this integrations use: +// +// kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" +// kamel run --resource secret:my-sec resource-secret-route.groovy --dev +// + +from('file:/etc/camel/data/secrets/my-sec/?fileName=my-secret-key&noop=true&idempotent=false') + .log('resource file content is: ${body}')