github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sns/dataProtectionPolicy.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package sns 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides an SNS data protection topic policy resource 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "encoding/json" 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // example, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{ 35 // Name: pulumi.String("example"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 41 // "Description": "Example data protection policy", 42 // "Name": "__example_data_protection_policy", 43 // "Statement": []map[string]interface{}{ 44 // map[string]interface{}{ 45 // "DataDirection": "Inbound", 46 // "DataIdentifier": []string{ 47 // "arn:aws:dataprotection::aws:data-identifier/EmailAddress", 48 // }, 49 // "Operation": map[string]interface{}{ 50 // "Deny": nil, 51 // }, 52 // "Principal": []string{ 53 // "*", 54 // }, 55 // "Sid": "__deny_statement_11ba9d96", 56 // }, 57 // }, 58 // "Version": "2021-06-01", 59 // }) 60 // if err != nil { 61 // return err 62 // } 63 // json0 := string(tmpJSON0) 64 // _, err = sns.NewDataProtectionPolicy(ctx, "example", &sns.DataProtectionPolicyArgs{ 65 // Arn: example.Arn, 66 // Policy: pulumi.String(json0), 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // return nil 72 // }) 73 // } 74 // 75 // ``` 76 // <!--End PulumiCodeChooser --> 77 // 78 // ## Import 79 // 80 // Using `pulumi import`, import SNS Data Protection Topic Policy using the topic ARN. For example: 81 // 82 // ```sh 83 // $ pulumi import aws:sns/dataProtectionPolicy:DataProtectionPolicy example arn:aws:sns:us-west-2:0123456789012:example 84 // ``` 85 type DataProtectionPolicy struct { 86 pulumi.CustomResourceState 87 88 // The ARN of the SNS topic 89 Arn pulumi.StringOutput `pulumi:"arn"` 90 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 91 Policy pulumi.StringOutput `pulumi:"policy"` 92 } 93 94 // NewDataProtectionPolicy registers a new resource with the given unique name, arguments, and options. 95 func NewDataProtectionPolicy(ctx *pulumi.Context, 96 name string, args *DataProtectionPolicyArgs, opts ...pulumi.ResourceOption) (*DataProtectionPolicy, error) { 97 if args == nil { 98 return nil, errors.New("missing one or more required arguments") 99 } 100 101 if args.Arn == nil { 102 return nil, errors.New("invalid value for required argument 'Arn'") 103 } 104 if args.Policy == nil { 105 return nil, errors.New("invalid value for required argument 'Policy'") 106 } 107 opts = internal.PkgResourceDefaultOpts(opts) 108 var resource DataProtectionPolicy 109 err := ctx.RegisterResource("aws:sns/dataProtectionPolicy:DataProtectionPolicy", name, args, &resource, opts...) 110 if err != nil { 111 return nil, err 112 } 113 return &resource, nil 114 } 115 116 // GetDataProtectionPolicy gets an existing DataProtectionPolicy resource's state with the given name, ID, and optional 117 // state properties that are used to uniquely qualify the lookup (nil if not required). 118 func GetDataProtectionPolicy(ctx *pulumi.Context, 119 name string, id pulumi.IDInput, state *DataProtectionPolicyState, opts ...pulumi.ResourceOption) (*DataProtectionPolicy, error) { 120 var resource DataProtectionPolicy 121 err := ctx.ReadResource("aws:sns/dataProtectionPolicy:DataProtectionPolicy", name, id, state, &resource, opts...) 122 if err != nil { 123 return nil, err 124 } 125 return &resource, nil 126 } 127 128 // Input properties used for looking up and filtering DataProtectionPolicy resources. 129 type dataProtectionPolicyState struct { 130 // The ARN of the SNS topic 131 Arn *string `pulumi:"arn"` 132 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 133 Policy *string `pulumi:"policy"` 134 } 135 136 type DataProtectionPolicyState struct { 137 // The ARN of the SNS topic 138 Arn pulumi.StringPtrInput 139 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 140 Policy pulumi.StringPtrInput 141 } 142 143 func (DataProtectionPolicyState) ElementType() reflect.Type { 144 return reflect.TypeOf((*dataProtectionPolicyState)(nil)).Elem() 145 } 146 147 type dataProtectionPolicyArgs struct { 148 // The ARN of the SNS topic 149 Arn string `pulumi:"arn"` 150 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 151 Policy string `pulumi:"policy"` 152 } 153 154 // The set of arguments for constructing a DataProtectionPolicy resource. 155 type DataProtectionPolicyArgs struct { 156 // The ARN of the SNS topic 157 Arn pulumi.StringInput 158 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 159 Policy pulumi.StringInput 160 } 161 162 func (DataProtectionPolicyArgs) ElementType() reflect.Type { 163 return reflect.TypeOf((*dataProtectionPolicyArgs)(nil)).Elem() 164 } 165 166 type DataProtectionPolicyInput interface { 167 pulumi.Input 168 169 ToDataProtectionPolicyOutput() DataProtectionPolicyOutput 170 ToDataProtectionPolicyOutputWithContext(ctx context.Context) DataProtectionPolicyOutput 171 } 172 173 func (*DataProtectionPolicy) ElementType() reflect.Type { 174 return reflect.TypeOf((**DataProtectionPolicy)(nil)).Elem() 175 } 176 177 func (i *DataProtectionPolicy) ToDataProtectionPolicyOutput() DataProtectionPolicyOutput { 178 return i.ToDataProtectionPolicyOutputWithContext(context.Background()) 179 } 180 181 func (i *DataProtectionPolicy) ToDataProtectionPolicyOutputWithContext(ctx context.Context) DataProtectionPolicyOutput { 182 return pulumi.ToOutputWithContext(ctx, i).(DataProtectionPolicyOutput) 183 } 184 185 // DataProtectionPolicyArrayInput is an input type that accepts DataProtectionPolicyArray and DataProtectionPolicyArrayOutput values. 186 // You can construct a concrete instance of `DataProtectionPolicyArrayInput` via: 187 // 188 // DataProtectionPolicyArray{ DataProtectionPolicyArgs{...} } 189 type DataProtectionPolicyArrayInput interface { 190 pulumi.Input 191 192 ToDataProtectionPolicyArrayOutput() DataProtectionPolicyArrayOutput 193 ToDataProtectionPolicyArrayOutputWithContext(context.Context) DataProtectionPolicyArrayOutput 194 } 195 196 type DataProtectionPolicyArray []DataProtectionPolicyInput 197 198 func (DataProtectionPolicyArray) ElementType() reflect.Type { 199 return reflect.TypeOf((*[]*DataProtectionPolicy)(nil)).Elem() 200 } 201 202 func (i DataProtectionPolicyArray) ToDataProtectionPolicyArrayOutput() DataProtectionPolicyArrayOutput { 203 return i.ToDataProtectionPolicyArrayOutputWithContext(context.Background()) 204 } 205 206 func (i DataProtectionPolicyArray) ToDataProtectionPolicyArrayOutputWithContext(ctx context.Context) DataProtectionPolicyArrayOutput { 207 return pulumi.ToOutputWithContext(ctx, i).(DataProtectionPolicyArrayOutput) 208 } 209 210 // DataProtectionPolicyMapInput is an input type that accepts DataProtectionPolicyMap and DataProtectionPolicyMapOutput values. 211 // You can construct a concrete instance of `DataProtectionPolicyMapInput` via: 212 // 213 // DataProtectionPolicyMap{ "key": DataProtectionPolicyArgs{...} } 214 type DataProtectionPolicyMapInput interface { 215 pulumi.Input 216 217 ToDataProtectionPolicyMapOutput() DataProtectionPolicyMapOutput 218 ToDataProtectionPolicyMapOutputWithContext(context.Context) DataProtectionPolicyMapOutput 219 } 220 221 type DataProtectionPolicyMap map[string]DataProtectionPolicyInput 222 223 func (DataProtectionPolicyMap) ElementType() reflect.Type { 224 return reflect.TypeOf((*map[string]*DataProtectionPolicy)(nil)).Elem() 225 } 226 227 func (i DataProtectionPolicyMap) ToDataProtectionPolicyMapOutput() DataProtectionPolicyMapOutput { 228 return i.ToDataProtectionPolicyMapOutputWithContext(context.Background()) 229 } 230 231 func (i DataProtectionPolicyMap) ToDataProtectionPolicyMapOutputWithContext(ctx context.Context) DataProtectionPolicyMapOutput { 232 return pulumi.ToOutputWithContext(ctx, i).(DataProtectionPolicyMapOutput) 233 } 234 235 type DataProtectionPolicyOutput struct{ *pulumi.OutputState } 236 237 func (DataProtectionPolicyOutput) ElementType() reflect.Type { 238 return reflect.TypeOf((**DataProtectionPolicy)(nil)).Elem() 239 } 240 241 func (o DataProtectionPolicyOutput) ToDataProtectionPolicyOutput() DataProtectionPolicyOutput { 242 return o 243 } 244 245 func (o DataProtectionPolicyOutput) ToDataProtectionPolicyOutputWithContext(ctx context.Context) DataProtectionPolicyOutput { 246 return o 247 } 248 249 // The ARN of the SNS topic 250 func (o DataProtectionPolicyOutput) Arn() pulumi.StringOutput { 251 return o.ApplyT(func(v *DataProtectionPolicy) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 252 } 253 254 // The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. 255 func (o DataProtectionPolicyOutput) Policy() pulumi.StringOutput { 256 return o.ApplyT(func(v *DataProtectionPolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput) 257 } 258 259 type DataProtectionPolicyArrayOutput struct{ *pulumi.OutputState } 260 261 func (DataProtectionPolicyArrayOutput) ElementType() reflect.Type { 262 return reflect.TypeOf((*[]*DataProtectionPolicy)(nil)).Elem() 263 } 264 265 func (o DataProtectionPolicyArrayOutput) ToDataProtectionPolicyArrayOutput() DataProtectionPolicyArrayOutput { 266 return o 267 } 268 269 func (o DataProtectionPolicyArrayOutput) ToDataProtectionPolicyArrayOutputWithContext(ctx context.Context) DataProtectionPolicyArrayOutput { 270 return o 271 } 272 273 func (o DataProtectionPolicyArrayOutput) Index(i pulumi.IntInput) DataProtectionPolicyOutput { 274 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DataProtectionPolicy { 275 return vs[0].([]*DataProtectionPolicy)[vs[1].(int)] 276 }).(DataProtectionPolicyOutput) 277 } 278 279 type DataProtectionPolicyMapOutput struct{ *pulumi.OutputState } 280 281 func (DataProtectionPolicyMapOutput) ElementType() reflect.Type { 282 return reflect.TypeOf((*map[string]*DataProtectionPolicy)(nil)).Elem() 283 } 284 285 func (o DataProtectionPolicyMapOutput) ToDataProtectionPolicyMapOutput() DataProtectionPolicyMapOutput { 286 return o 287 } 288 289 func (o DataProtectionPolicyMapOutput) ToDataProtectionPolicyMapOutputWithContext(ctx context.Context) DataProtectionPolicyMapOutput { 290 return o 291 } 292 293 func (o DataProtectionPolicyMapOutput) MapIndex(k pulumi.StringInput) DataProtectionPolicyOutput { 294 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DataProtectionPolicy { 295 return vs[0].(map[string]*DataProtectionPolicy)[vs[1].(string)] 296 }).(DataProtectionPolicyOutput) 297 } 298 299 func init() { 300 pulumi.RegisterInputType(reflect.TypeOf((*DataProtectionPolicyInput)(nil)).Elem(), &DataProtectionPolicy{}) 301 pulumi.RegisterInputType(reflect.TypeOf((*DataProtectionPolicyArrayInput)(nil)).Elem(), DataProtectionPolicyArray{}) 302 pulumi.RegisterInputType(reflect.TypeOf((*DataProtectionPolicyMapInput)(nil)).Elem(), DataProtectionPolicyMap{}) 303 pulumi.RegisterOutputType(DataProtectionPolicyOutput{}) 304 pulumi.RegisterOutputType(DataProtectionPolicyArrayOutput{}) 305 pulumi.RegisterOutputType(DataProtectionPolicyMapOutput{}) 306 }