# SnsActionProperty

Describes an action to publish to an Amazon SNS topic.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iot as iot } from 'aws-cdk-lib';
const snsActionProperty: iot.CfnTopicRule.SnsActionProperty = {
  roleArn: 'roleArn',
  targetArn: 'targetArn',

  // the properties below are optional
  messageFormat: 'messageFormat',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iot as iot

sns_action_property = iot.CfnTopicRule.SnsActionProperty(
    role_arn="roleArn",
    target_arn="targetArn",

    # the properties below are optional
    message_format="messageFormat"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iot.*;

SnsActionProperty snsActionProperty = SnsActionProperty.builder()
        .roleArn("roleArn")
        .targetArn("targetArn")

        // the properties below are optional
        .messageFormat("messageFormat")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IoT;

var snsActionProperty = new SnsActionProperty {
    RoleArn = "roleArn",
    TargetArn = "targetArn",

    // the properties below are optional
    MessageFormat = "messageFormat"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

snsActionProperty := &SnsActionProperty{
	RoleArn: jsii.String("roleArn"),
	TargetArn: jsii.String("targetArn"),

	// the properties below are optional
	MessageFormat: jsii.String("messageFormat"),
}
```

## Properties

- `messageFormat`: string — (Optional) The message format of the message to publish.

  Accepted values are "JSON" and "RAW". The default value of the attribute is "RAW". SNS uses this setting to determine if the payload should be parsed and relevant platform-specific bits of the payload should be extracted. For more information, see [Amazon SNS Message and JSON Formats](https://docs.aws.amazon.com/sns/latest/dg/json-formats.html) in the *Amazon Simple Notification Service Developer Guide* .

- `roleArn`: string (required) — The ARN of the IAM role that grants access.

- `targetArn`: string (required) — The ARN of the SNS topic.
