node-red-contrib-aws
Version:
A collection of Node-RED nodes for AWS. Includes nodes for DynamoDB, EC2, IoT, Kinesis, Lambda, SNS, SQS and S3.
252 lines (215 loc) • 8.01 kB
HTML
<!--
Copyright 2021 Daniel Thomas.
Licensed 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.
-->
<script type="text/x-red" data-template-name="AWS SQS">
<style scoped>
.hiddenAttrs {display:none;}
.visibleAttrs {display:block;}
</style>
<div class="form-row">
<label for="node-input-aws"><i class="fa fa-user"></i> AWS</label>
<input type="text" id="node-input-aws">
</div>
<div class="form-row">
<label for="node-input-operation"><i class="fa fa-wrench"></i> Operation</label>
<select type="text" id="node-input-operation">
<option value="AddPermission">AddPermission</option>
<option value="ChangeMessageVisibility">ChangeMessageVisibility</option>
<option value="ChangeMessageVisibilityBatch">ChangeMessageVisibilityBatch</option>
<option value="CreateQueue">CreateQueue</option>
<option value="DeleteMessage">DeleteMessage</option>
<option value="DeleteMessageBatch">DeleteMessageBatch</option>
<option value="DeleteQueue">DeleteQueue</option>
<option value="GetQueueAttributes">GetQueueAttributes</option>
<option value="GetQueueUrl">GetQueueUrl</option>
<option value="ListDeadLetterSourceQueues">ListDeadLetterSourceQueues</option>
<option value="ListQueueTags">ListQueueTags</option>
<option value="ListQueues">ListQueues</option>
<option value="PurgeQueue">PurgeQueue</option>
<option value="ReceiveMessage">ReceiveMessage</option>
<option value="RemovePermission">RemovePermission</option>
<option value="SendMessage">SendMessage</option>
<option value="SendMessageBatch">SendMessageBatch</option>
<option value="SetQueueAttributes">SetQueueAttributes</option>
<option value="TagQueue">TagQueue</option>
<option value="UntagQueue">UntagQueue</option>
;
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i>Name</label>
<input type="text" id="node-input-name" placeholder="Name"></input>
</div>
<hr/>
<div id="AttrHolder">
<div class="form-row" id='QueueUrlAttr' class='hiddenAttrs'>
<label for="node-input-QueueUrl"><i class="fa fa-tag"></i>QueueUrl</label>
<input type="text" id="node-input-QueueUrl" placeholder="QueueUrl"></input>
</div>
<div class="form-row" id='LabelAttr' class='hiddenAttrs'>
<label for="node-input-Label"><i class="fa fa-tag"></i>Label</label>
<input type="text" id="node-input-Label" placeholder="Label"></input>
</div>
<div class="form-row" id='AWSAccountIdsAttr' class='hiddenAttrs'>
<label for="node-input-AWSAccountIds"><i class="fa fa-tag"></i>AWSAccountIds</label>
<input type="text" id="node-input-AWSAccountIds" placeholder="AWSAccountIds"></input>
</div>
<div class="form-row" id='ActionsAttr' class='hiddenAttrs'>
<label for="node-input-Actions"><i class="fa fa-tag"></i>Actions</label>
<input type="text" id="node-input-Actions" placeholder="Actions"></input>
</div>
<div class="form-row" id='ReceiptHandleAttr' class='hiddenAttrs'>
<label for="node-input-ReceiptHandle"><i class="fa fa-tag"></i>ReceiptHandle</label>
<input type="text" id="node-input-ReceiptHandle" placeholder="ReceiptHandle"></input>
</div>
<div class="form-row" id='VisibilityTimeoutAttr' class='hiddenAttrs'>
<label for="node-input-VisibilityTimeout"><i class="fa fa-tag"></i>VisibilityTimeout</label>
<input type="text" id="node-input-VisibilityTimeout" placeholder="VisibilityTimeout"></input>
</div>
<div class="form-row" id='EntriesAttr' class='hiddenAttrs'>
<label for="node-input-Entries"><i class="fa fa-tag"></i>Entries</label>
<input type="text" id="node-input-Entries" placeholder="Entries"></input>
</div>
<div class="form-row" id='QueueNameAttr' class='hiddenAttrs'>
<label for="node-input-QueueName"><i class="fa fa-tag"></i>QueueName</label>
<input type="text" id="node-input-QueueName" placeholder="QueueName"></input>
</div>
<div class="form-row" id='MessageBodyAttr' class='hiddenAttrs'>
<label for="node-input-MessageBody"><i class="fa fa-tag"></i>MessageBody</label>
<input type="text" id="node-input-MessageBody" placeholder="MessageBody"></input>
</div>
<div class="form-row" id='AttributesAttr' class='hiddenAttrs'>
<label for="node-input-Attributes"><i class="fa fa-tag"></i>Attributes</label>
<input type="text" id="node-input-Attributes" placeholder="Attributes"></input>
</div>
<div class="form-row" id='TagsAttr' class='hiddenAttrs'>
<label for="node-input-Tags"><i class="fa fa-tag"></i>Tags</label>
<input type="text" id="node-input-Tags" placeholder="Tags"></input>
</div>
<div class="form-row" id='TagKeysAttr' class='hiddenAttrs'>
<label for="node-input-TagKeys"><i class="fa fa-tag"></i>TagKeys</label>
<input type="text" id="node-input-TagKeys" placeholder="TagKeys"></input>
</div>
</div>
<script>
var nodeOps={
AddPermission:[
'#QueueUrlAttr','#LabelAttr','#AWSAccountIdsAttr','#ActionsAttr'
],
ChangeMessageVisibility:[
'#QueueUrlAttr','#ReceiptHandleAttr','#VisibilityTimeoutAttr'
],
ChangeMessageVisibilityBatch:[
'#QueueUrlAttr','#EntriesAttr'
],
CreateQueue:[
'#QueueNameAttr'
],
DeleteMessage:[
'#QueueUrlAttr','#ReceiptHandleAttr'
],
DeleteMessageBatch:[
'#QueueUrlAttr','#EntriesAttr'
],
DeleteQueue:[
'#QueueUrlAttr'
],
GetQueueAttributes:[
'#QueueUrlAttr'
],
GetQueueUrl:[
'#QueueNameAttr'
],
ListDeadLetterSourceQueues:[
'#QueueUrlAttr'
],
ListQueueTags:[
'#QueueUrlAttr'
],
ListQueues:[
],
PurgeQueue:[
'#QueueUrlAttr'
],
ReceiveMessage:[
'#QueueUrlAttr'
],
RemovePermission:[
'#QueueUrlAttr','#LabelAttr'
],
SendMessage:[
'#QueueUrlAttr','#MessageBodyAttr'
],
SendMessageBatch:[
'#QueueUrlAttr','#EntriesAttr'
],
SetQueueAttributes:[
'#QueueUrlAttr','#AttributesAttr'
],
TagQueue:[
'#QueueUrlAttr','#TagsAttr'
],
UntagQueue:[
'#QueueUrlAttr','#TagKeysAttr'
]
};
$('#node-input-operation').on('change',function(){
$('#AttrHolder').children().addClass('hiddenAttrs').removeClass('visibleAttrs');
if (nodeOps[this.value])
$(nodeOps[this.value].join()).addClass('visibleAttrs').removeClass('hiddenAttrs');
});
</script>
</script>
<script type="text/x-red" data-help-name="amazon SQS">
<p>
AWS Amazon Simple Queue Service
</p>
<p>
<b>Descriptions to be added</b<
</p>
<p>
NOTE: Parameters must be specified in the message, using the case specified in the AWS API documentation (normally UpperCaseLeading)..
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('AWS SQS',{
category: 'AWS',
color:"#C0DEED",
defaults: {
aws: {type:"amazon config",required:true},
operation: { value: 'AddPermission' },
QueueUrl: { value: ""} ,
Label: { value: ""} ,
AWSAccountIds: { value: ""} ,
Actions: { value: ""} ,
ReceiptHandle: { value: ""} ,
VisibilityTimeout: { value: ""} ,
Entries: { value: ""} ,
QueueName: { value: ""} ,
MessageBody: { value: ""} ,
Attributes: { value: ""} ,
Tags: { value: ""} ,
TagKeys: { value: ""} ,
name: { value: "" }
},
inputs:1,
outputs: 2,
outputLabels: ["data","err"],
icon: "aws.png",
align: "right",
label: function() {
return this.name || "SQS " + this.operation;
},
oneditprepare: function () {
}
});
</script>