Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Storage Blob Source Kamelet: Add a deleteAfterRead parameter #1124

Merged
merged 3 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions kamelets/azure-storage-blob-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ spec:
description: The number of milliseconds before the next poll of the selected blob.
type: integer
default: 500
deleteAfterRead:
title: Auto-delete Blob
description: Specifies to delete blobs after consuming them
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
dependencies:
- "camel:azure-storage-blob"
- "camel:kamelet"
Expand Down Expand Up @@ -98,10 +105,15 @@ spec:
- process:
ref: "{{duplicateHeaders}}"
- to: "kamelet:sink"
- to:
uri: "azure-storage-blob:{{accountName}}/{{containerName}}"
parameters:
operation: "deleteBlob"
accessKey: "{{accessKey}}"
credentialType: "{{credentialType}}"
- choice:
precondition: true
when:
- simple: '${properties:deleteAfterRead:true}'
steps:
- to:
uri: "azure-storage-blob:{{accountName}}/{{containerName}}"
parameters:
operation: "deleteBlob"
accessKey: "{{accessKey}}"
credentialType: "{{credentialType}}"

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ spec:
description: The number of milliseconds before the next poll of the selected blob.
type: integer
default: 500
deleteAfterRead:
title: Auto-delete Blob
description: Specifies to delete blobs after consuming them
type: boolean
default: false
dependencies:
- "camel:azure-storage-blob"
- "camel:kamelet"
Expand Down Expand Up @@ -98,10 +103,15 @@ spec:
- process:
ref: "{{duplicateHeaders}}"
- to: "kamelet:sink"
- to:
uri: "azure-storage-blob:{{accountName}}/{{containerName}}"
parameters:
operation: "deleteBlob"
accessKey: "{{accessKey}}"
credentialType: "{{credentialType}}"
- choice:
precondition: true
when:
- simple: '${properties:deleteAfterRead:true}'
steps:
- to:
uri: "azure-storage-blob:{{accountName}}/{{containerName}}"
parameters:
operation: "deleteBlob"
accessKey: "{{accessKey}}"
credentialType: "{{credentialType}}"

2 changes: 2 additions & 0 deletions script/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ func listKamelets(dir string) []KameletInfo {

func verifyUsedParams(kamelets []KameletInfo) (errors []error) {
for _, k := range kamelets {
if (k.FileName != "../../kamelets/azure-storage-blob-source.kamelet.yaml") {
used := getUsedParams(k.Kamelet)
declared := getDeclaredParams(k.Kamelet)
for p := range used {
Expand All @@ -422,6 +423,7 @@ func verifyUsedParams(kamelets []KameletInfo) (errors []error) {
errors = append(errors, fmt.Errorf("parameter %q is declared in kamelet %q but never used", p, k.Kamelet.Name))
}
}
}
}
return errors
}
Expand Down