github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/msk/replicator.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 msk 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 // Resource for managing an AWS Managed Streaming for Kafka Replicator. 16 // 17 // ## Example Usage 18 // 19 // ### Basic Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/msk" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := msk.NewReplicator(ctx, "test", &msk.ReplicatorArgs{ 34 // ReplicatorName: pulumi.String("test-name"), 35 // Description: pulumi.String("test-description"), 36 // ServiceExecutionRoleArn: pulumi.Any(sourceAwsIamRole.Arn), 37 // KafkaClusters: msk.ReplicatorKafkaClusterArray{ 38 // &msk.ReplicatorKafkaClusterArgs{ 39 // AmazonMskCluster: &msk.ReplicatorKafkaClusterAmazonMskClusterArgs{ 40 // MskClusterArn: pulumi.Any(source.Arn), 41 // }, 42 // VpcConfig: &msk.ReplicatorKafkaClusterVpcConfigArgs{ 43 // SubnetIds: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:9,27-48), 44 // SecurityGroupsIds: pulumi.StringArray{ 45 // sourceAwsSecurityGroup.Id, 46 // }, 47 // }, 48 // }, 49 // &msk.ReplicatorKafkaClusterArgs{ 50 // AmazonMskCluster: &msk.ReplicatorKafkaClusterAmazonMskClusterArgs{ 51 // MskClusterArn: pulumi.Any(target.Arn), 52 // }, 53 // VpcConfig: &msk.ReplicatorKafkaClusterVpcConfigArgs{ 54 // SubnetIds: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:17,27-48), 55 // SecurityGroupsIds: pulumi.StringArray{ 56 // targetAwsSecurityGroup.Id, 57 // }, 58 // }, 59 // }, 60 // }, 61 // ReplicationInfoList: &msk.ReplicatorReplicationInfoListArgs{ 62 // SourceKafkaClusterArn: pulumi.Any(source.Arn), 63 // TargetKafkaClusterArn: pulumi.Any(target.Arn), 64 // TargetCompressionType: pulumi.String("NONE"), 65 // TopicReplications: msk.ReplicatorReplicationInfoListTopicReplicationArray{ 66 // &msk.ReplicatorReplicationInfoListTopicReplicationArgs{ 67 // TopicsToReplicates: pulumi.StringArray{ 68 // pulumi.String(".*"), 69 // }, 70 // }, 71 // }, 72 // ConsumerGroupReplications: msk.ReplicatorReplicationInfoListConsumerGroupReplicationArray{ 73 // &msk.ReplicatorReplicationInfoListConsumerGroupReplicationArgs{ 74 // ConsumerGroupsToReplicates: pulumi.StringArray{ 75 // pulumi.String(".*"), 76 // }, 77 // }, 78 // }, 79 // }, 80 // }) 81 // if err != nil { 82 // return err 83 // } 84 // return nil 85 // }) 86 // } 87 // ``` 88 // <!--End PulumiCodeChooser --> 89 // 90 // ## Import 91 // 92 // Using `pulumi import`, import MSK replicators using the replicator ARN. For example: 93 // 94 // ```sh 95 // $ pulumi import aws:msk/replicator:Replicator example arn:aws:kafka:us-west-2:123456789012:configuration/example/279c0212-d057-4dba-9aa9-1c4e5a25bfc7-3 96 // ``` 97 type Replicator struct { 98 pulumi.CustomResourceState 99 100 // ARN of the Replicator. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. 101 Arn pulumi.StringOutput `pulumi:"arn"` 102 CurrentVersion pulumi.StringOutput `pulumi:"currentVersion"` 103 // A summary description of the replicator. 104 Description pulumi.StringPtrOutput `pulumi:"description"` 105 // A list of Kafka clusters which are targets of the replicator. 106 KafkaClusters ReplicatorKafkaClusterArrayOutput `pulumi:"kafkaClusters"` 107 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 108 ReplicationInfoList ReplicatorReplicationInfoListOutput `pulumi:"replicationInfoList"` 109 // The name of the replicator. 110 ReplicatorName pulumi.StringOutput `pulumi:"replicatorName"` 111 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 112 ServiceExecutionRoleArn pulumi.StringOutput `pulumi:"serviceExecutionRoleArn"` 113 Tags pulumi.StringMapOutput `pulumi:"tags"` 114 // Deprecated: Please use `tags` instead. 115 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 116 } 117 118 // NewReplicator registers a new resource with the given unique name, arguments, and options. 119 func NewReplicator(ctx *pulumi.Context, 120 name string, args *ReplicatorArgs, opts ...pulumi.ResourceOption) (*Replicator, error) { 121 if args == nil { 122 return nil, errors.New("missing one or more required arguments") 123 } 124 125 if args.KafkaClusters == nil { 126 return nil, errors.New("invalid value for required argument 'KafkaClusters'") 127 } 128 if args.ReplicationInfoList == nil { 129 return nil, errors.New("invalid value for required argument 'ReplicationInfoList'") 130 } 131 if args.ReplicatorName == nil { 132 return nil, errors.New("invalid value for required argument 'ReplicatorName'") 133 } 134 if args.ServiceExecutionRoleArn == nil { 135 return nil, errors.New("invalid value for required argument 'ServiceExecutionRoleArn'") 136 } 137 opts = internal.PkgResourceDefaultOpts(opts) 138 var resource Replicator 139 err := ctx.RegisterResource("aws:msk/replicator:Replicator", name, args, &resource, opts...) 140 if err != nil { 141 return nil, err 142 } 143 return &resource, nil 144 } 145 146 // GetReplicator gets an existing Replicator resource's state with the given name, ID, and optional 147 // state properties that are used to uniquely qualify the lookup (nil if not required). 148 func GetReplicator(ctx *pulumi.Context, 149 name string, id pulumi.IDInput, state *ReplicatorState, opts ...pulumi.ResourceOption) (*Replicator, error) { 150 var resource Replicator 151 err := ctx.ReadResource("aws:msk/replicator:Replicator", name, id, state, &resource, opts...) 152 if err != nil { 153 return nil, err 154 } 155 return &resource, nil 156 } 157 158 // Input properties used for looking up and filtering Replicator resources. 159 type replicatorState struct { 160 // ARN of the Replicator. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. 161 Arn *string `pulumi:"arn"` 162 CurrentVersion *string `pulumi:"currentVersion"` 163 // A summary description of the replicator. 164 Description *string `pulumi:"description"` 165 // A list of Kafka clusters which are targets of the replicator. 166 KafkaClusters []ReplicatorKafkaCluster `pulumi:"kafkaClusters"` 167 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 168 ReplicationInfoList *ReplicatorReplicationInfoList `pulumi:"replicationInfoList"` 169 // The name of the replicator. 170 ReplicatorName *string `pulumi:"replicatorName"` 171 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 172 ServiceExecutionRoleArn *string `pulumi:"serviceExecutionRoleArn"` 173 Tags map[string]string `pulumi:"tags"` 174 // Deprecated: Please use `tags` instead. 175 TagsAll map[string]string `pulumi:"tagsAll"` 176 } 177 178 type ReplicatorState struct { 179 // ARN of the Replicator. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. 180 Arn pulumi.StringPtrInput 181 CurrentVersion pulumi.StringPtrInput 182 // A summary description of the replicator. 183 Description pulumi.StringPtrInput 184 // A list of Kafka clusters which are targets of the replicator. 185 KafkaClusters ReplicatorKafkaClusterArrayInput 186 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 187 ReplicationInfoList ReplicatorReplicationInfoListPtrInput 188 // The name of the replicator. 189 ReplicatorName pulumi.StringPtrInput 190 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 191 ServiceExecutionRoleArn pulumi.StringPtrInput 192 Tags pulumi.StringMapInput 193 // Deprecated: Please use `tags` instead. 194 TagsAll pulumi.StringMapInput 195 } 196 197 func (ReplicatorState) ElementType() reflect.Type { 198 return reflect.TypeOf((*replicatorState)(nil)).Elem() 199 } 200 201 type replicatorArgs struct { 202 // A summary description of the replicator. 203 Description *string `pulumi:"description"` 204 // A list of Kafka clusters which are targets of the replicator. 205 KafkaClusters []ReplicatorKafkaCluster `pulumi:"kafkaClusters"` 206 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 207 ReplicationInfoList ReplicatorReplicationInfoList `pulumi:"replicationInfoList"` 208 // The name of the replicator. 209 ReplicatorName string `pulumi:"replicatorName"` 210 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 211 ServiceExecutionRoleArn string `pulumi:"serviceExecutionRoleArn"` 212 Tags map[string]string `pulumi:"tags"` 213 } 214 215 // The set of arguments for constructing a Replicator resource. 216 type ReplicatorArgs struct { 217 // A summary description of the replicator. 218 Description pulumi.StringPtrInput 219 // A list of Kafka clusters which are targets of the replicator. 220 KafkaClusters ReplicatorKafkaClusterArrayInput 221 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 222 ReplicationInfoList ReplicatorReplicationInfoListInput 223 // The name of the replicator. 224 ReplicatorName pulumi.StringInput 225 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 226 ServiceExecutionRoleArn pulumi.StringInput 227 Tags pulumi.StringMapInput 228 } 229 230 func (ReplicatorArgs) ElementType() reflect.Type { 231 return reflect.TypeOf((*replicatorArgs)(nil)).Elem() 232 } 233 234 type ReplicatorInput interface { 235 pulumi.Input 236 237 ToReplicatorOutput() ReplicatorOutput 238 ToReplicatorOutputWithContext(ctx context.Context) ReplicatorOutput 239 } 240 241 func (*Replicator) ElementType() reflect.Type { 242 return reflect.TypeOf((**Replicator)(nil)).Elem() 243 } 244 245 func (i *Replicator) ToReplicatorOutput() ReplicatorOutput { 246 return i.ToReplicatorOutputWithContext(context.Background()) 247 } 248 249 func (i *Replicator) ToReplicatorOutputWithContext(ctx context.Context) ReplicatorOutput { 250 return pulumi.ToOutputWithContext(ctx, i).(ReplicatorOutput) 251 } 252 253 // ReplicatorArrayInput is an input type that accepts ReplicatorArray and ReplicatorArrayOutput values. 254 // You can construct a concrete instance of `ReplicatorArrayInput` via: 255 // 256 // ReplicatorArray{ ReplicatorArgs{...} } 257 type ReplicatorArrayInput interface { 258 pulumi.Input 259 260 ToReplicatorArrayOutput() ReplicatorArrayOutput 261 ToReplicatorArrayOutputWithContext(context.Context) ReplicatorArrayOutput 262 } 263 264 type ReplicatorArray []ReplicatorInput 265 266 func (ReplicatorArray) ElementType() reflect.Type { 267 return reflect.TypeOf((*[]*Replicator)(nil)).Elem() 268 } 269 270 func (i ReplicatorArray) ToReplicatorArrayOutput() ReplicatorArrayOutput { 271 return i.ToReplicatorArrayOutputWithContext(context.Background()) 272 } 273 274 func (i ReplicatorArray) ToReplicatorArrayOutputWithContext(ctx context.Context) ReplicatorArrayOutput { 275 return pulumi.ToOutputWithContext(ctx, i).(ReplicatorArrayOutput) 276 } 277 278 // ReplicatorMapInput is an input type that accepts ReplicatorMap and ReplicatorMapOutput values. 279 // You can construct a concrete instance of `ReplicatorMapInput` via: 280 // 281 // ReplicatorMap{ "key": ReplicatorArgs{...} } 282 type ReplicatorMapInput interface { 283 pulumi.Input 284 285 ToReplicatorMapOutput() ReplicatorMapOutput 286 ToReplicatorMapOutputWithContext(context.Context) ReplicatorMapOutput 287 } 288 289 type ReplicatorMap map[string]ReplicatorInput 290 291 func (ReplicatorMap) ElementType() reflect.Type { 292 return reflect.TypeOf((*map[string]*Replicator)(nil)).Elem() 293 } 294 295 func (i ReplicatorMap) ToReplicatorMapOutput() ReplicatorMapOutput { 296 return i.ToReplicatorMapOutputWithContext(context.Background()) 297 } 298 299 func (i ReplicatorMap) ToReplicatorMapOutputWithContext(ctx context.Context) ReplicatorMapOutput { 300 return pulumi.ToOutputWithContext(ctx, i).(ReplicatorMapOutput) 301 } 302 303 type ReplicatorOutput struct{ *pulumi.OutputState } 304 305 func (ReplicatorOutput) ElementType() reflect.Type { 306 return reflect.TypeOf((**Replicator)(nil)).Elem() 307 } 308 309 func (o ReplicatorOutput) ToReplicatorOutput() ReplicatorOutput { 310 return o 311 } 312 313 func (o ReplicatorOutput) ToReplicatorOutputWithContext(ctx context.Context) ReplicatorOutput { 314 return o 315 } 316 317 // ARN of the Replicator. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. 318 func (o ReplicatorOutput) Arn() pulumi.StringOutput { 319 return o.ApplyT(func(v *Replicator) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 320 } 321 322 func (o ReplicatorOutput) CurrentVersion() pulumi.StringOutput { 323 return o.ApplyT(func(v *Replicator) pulumi.StringOutput { return v.CurrentVersion }).(pulumi.StringOutput) 324 } 325 326 // A summary description of the replicator. 327 func (o ReplicatorOutput) Description() pulumi.StringPtrOutput { 328 return o.ApplyT(func(v *Replicator) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 329 } 330 331 // A list of Kafka clusters which are targets of the replicator. 332 func (o ReplicatorOutput) KafkaClusters() ReplicatorKafkaClusterArrayOutput { 333 return o.ApplyT(func(v *Replicator) ReplicatorKafkaClusterArrayOutput { return v.KafkaClusters }).(ReplicatorKafkaClusterArrayOutput) 334 } 335 336 // A list of replication configurations, where each configuration targets a given source cluster to target cluster replication flow. 337 func (o ReplicatorOutput) ReplicationInfoList() ReplicatorReplicationInfoListOutput { 338 return o.ApplyT(func(v *Replicator) ReplicatorReplicationInfoListOutput { return v.ReplicationInfoList }).(ReplicatorReplicationInfoListOutput) 339 } 340 341 // The name of the replicator. 342 func (o ReplicatorOutput) ReplicatorName() pulumi.StringOutput { 343 return o.ApplyT(func(v *Replicator) pulumi.StringOutput { return v.ReplicatorName }).(pulumi.StringOutput) 344 } 345 346 // The ARN of the IAM role used by the replicator to access resources in the customer's account (e.g source and target clusters). 347 func (o ReplicatorOutput) ServiceExecutionRoleArn() pulumi.StringOutput { 348 return o.ApplyT(func(v *Replicator) pulumi.StringOutput { return v.ServiceExecutionRoleArn }).(pulumi.StringOutput) 349 } 350 351 func (o ReplicatorOutput) Tags() pulumi.StringMapOutput { 352 return o.ApplyT(func(v *Replicator) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 353 } 354 355 // Deprecated: Please use `tags` instead. 356 func (o ReplicatorOutput) TagsAll() pulumi.StringMapOutput { 357 return o.ApplyT(func(v *Replicator) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 358 } 359 360 type ReplicatorArrayOutput struct{ *pulumi.OutputState } 361 362 func (ReplicatorArrayOutput) ElementType() reflect.Type { 363 return reflect.TypeOf((*[]*Replicator)(nil)).Elem() 364 } 365 366 func (o ReplicatorArrayOutput) ToReplicatorArrayOutput() ReplicatorArrayOutput { 367 return o 368 } 369 370 func (o ReplicatorArrayOutput) ToReplicatorArrayOutputWithContext(ctx context.Context) ReplicatorArrayOutput { 371 return o 372 } 373 374 func (o ReplicatorArrayOutput) Index(i pulumi.IntInput) ReplicatorOutput { 375 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Replicator { 376 return vs[0].([]*Replicator)[vs[1].(int)] 377 }).(ReplicatorOutput) 378 } 379 380 type ReplicatorMapOutput struct{ *pulumi.OutputState } 381 382 func (ReplicatorMapOutput) ElementType() reflect.Type { 383 return reflect.TypeOf((*map[string]*Replicator)(nil)).Elem() 384 } 385 386 func (o ReplicatorMapOutput) ToReplicatorMapOutput() ReplicatorMapOutput { 387 return o 388 } 389 390 func (o ReplicatorMapOutput) ToReplicatorMapOutputWithContext(ctx context.Context) ReplicatorMapOutput { 391 return o 392 } 393 394 func (o ReplicatorMapOutput) MapIndex(k pulumi.StringInput) ReplicatorOutput { 395 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Replicator { 396 return vs[0].(map[string]*Replicator)[vs[1].(string)] 397 }).(ReplicatorOutput) 398 } 399 400 func init() { 401 pulumi.RegisterInputType(reflect.TypeOf((*ReplicatorInput)(nil)).Elem(), &Replicator{}) 402 pulumi.RegisterInputType(reflect.TypeOf((*ReplicatorArrayInput)(nil)).Elem(), ReplicatorArray{}) 403 pulumi.RegisterInputType(reflect.TypeOf((*ReplicatorMapInput)(nil)).Elem(), ReplicatorMap{}) 404 pulumi.RegisterOutputType(ReplicatorOutput{}) 405 pulumi.RegisterOutputType(ReplicatorArrayOutput{}) 406 pulumi.RegisterOutputType(ReplicatorMapOutput{}) 407 }