ps/Modules/Alkami.PowerShell.Common/Public/New-SNSMessageAttribute.ps1
2023-05-30 22:51:22 -07:00

34 lines
1.2 KiB
PowerShell

function New-SNSMessageAttribute {
<#
.SYNOPSIS
Create an SNSMessageAttribute
.PARAMETER Value
Attribute Value.
.PARAMETER DataType
Data Type of the attribute. Possible options are String, String.Array, Number, and Binary. Only String and Binary are
valid for triggering Lambda functions
.PARAMETER AttributeValueName
Name of the attribute data field. Valid options are StringValue or BinaryValue
#>
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[object]$Value,
[ValidateSet("String", "String.Array", "Number", "Binary")]
[string]$DataType = "String",
[ValidateSet("StringValue", "BinaryValue")]
[string]$AttributeValueName = "StringValue"
)
Import-AWSModule
$attribute = New-Object -TypeName Amazon.SimpleNotificationService.Model.MessageAttributeValue
$attribute.DataType = $DataType
$attribute.$AttributeValueName = $Value
# This typecast is required, because Powershell. Do not remove it.
return [Amazon.SimpleNotificationService.Model.MessageAttributeValue]$attribute
}
Set-Alias -Name AsSNSAttribute -Value New-SNSMessageAttribute