github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudwatch/logStream.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 cloudwatch 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 a CloudWatch Log Stream resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // yada, err := cloudwatch.NewLogGroup(ctx, "yada", &cloudwatch.LogGroupArgs{ 33 // Name: pulumi.String("Yada"), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // _, err = cloudwatch.NewLogStream(ctx, "foo", &cloudwatch.LogStreamArgs{ 39 // Name: pulumi.String("SampleLogStream1234"), 40 // LogGroupName: yada.Name, 41 // }) 42 // if err != nil { 43 // return err 44 // } 45 // return nil 46 // }) 47 // } 48 // 49 // ``` 50 // <!--End PulumiCodeChooser --> 51 // 52 // ## Import 53 // 54 // Using `pulumi import`, import Cloudwatch Log Stream using the stream's `log_group_name` and `name`. For example: 55 // 56 // ```sh 57 // $ pulumi import aws:cloudwatch/logStream:LogStream foo Yada:SampleLogStream1234 58 // ``` 59 type LogStream struct { 60 pulumi.CustomResourceState 61 62 // The Amazon Resource Name (ARN) specifying the log stream. 63 Arn pulumi.StringOutput `pulumi:"arn"` 64 // The name of the log group under which the log stream is to be created. 65 LogGroupName pulumi.StringOutput `pulumi:"logGroupName"` 66 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 67 Name pulumi.StringOutput `pulumi:"name"` 68 } 69 70 // NewLogStream registers a new resource with the given unique name, arguments, and options. 71 func NewLogStream(ctx *pulumi.Context, 72 name string, args *LogStreamArgs, opts ...pulumi.ResourceOption) (*LogStream, error) { 73 if args == nil { 74 return nil, errors.New("missing one or more required arguments") 75 } 76 77 if args.LogGroupName == nil { 78 return nil, errors.New("invalid value for required argument 'LogGroupName'") 79 } 80 opts = internal.PkgResourceDefaultOpts(opts) 81 var resource LogStream 82 err := ctx.RegisterResource("aws:cloudwatch/logStream:LogStream", name, args, &resource, opts...) 83 if err != nil { 84 return nil, err 85 } 86 return &resource, nil 87 } 88 89 // GetLogStream gets an existing LogStream resource's state with the given name, ID, and optional 90 // state properties that are used to uniquely qualify the lookup (nil if not required). 91 func GetLogStream(ctx *pulumi.Context, 92 name string, id pulumi.IDInput, state *LogStreamState, opts ...pulumi.ResourceOption) (*LogStream, error) { 93 var resource LogStream 94 err := ctx.ReadResource("aws:cloudwatch/logStream:LogStream", name, id, state, &resource, opts...) 95 if err != nil { 96 return nil, err 97 } 98 return &resource, nil 99 } 100 101 // Input properties used for looking up and filtering LogStream resources. 102 type logStreamState struct { 103 // The Amazon Resource Name (ARN) specifying the log stream. 104 Arn *string `pulumi:"arn"` 105 // The name of the log group under which the log stream is to be created. 106 LogGroupName *string `pulumi:"logGroupName"` 107 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 108 Name *string `pulumi:"name"` 109 } 110 111 type LogStreamState struct { 112 // The Amazon Resource Name (ARN) specifying the log stream. 113 Arn pulumi.StringPtrInput 114 // The name of the log group under which the log stream is to be created. 115 LogGroupName pulumi.StringPtrInput 116 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 117 Name pulumi.StringPtrInput 118 } 119 120 func (LogStreamState) ElementType() reflect.Type { 121 return reflect.TypeOf((*logStreamState)(nil)).Elem() 122 } 123 124 type logStreamArgs struct { 125 // The name of the log group under which the log stream is to be created. 126 LogGroupName string `pulumi:"logGroupName"` 127 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 128 Name *string `pulumi:"name"` 129 } 130 131 // The set of arguments for constructing a LogStream resource. 132 type LogStreamArgs struct { 133 // The name of the log group under which the log stream is to be created. 134 LogGroupName pulumi.StringInput 135 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 136 Name pulumi.StringPtrInput 137 } 138 139 func (LogStreamArgs) ElementType() reflect.Type { 140 return reflect.TypeOf((*logStreamArgs)(nil)).Elem() 141 } 142 143 type LogStreamInput interface { 144 pulumi.Input 145 146 ToLogStreamOutput() LogStreamOutput 147 ToLogStreamOutputWithContext(ctx context.Context) LogStreamOutput 148 } 149 150 func (*LogStream) ElementType() reflect.Type { 151 return reflect.TypeOf((**LogStream)(nil)).Elem() 152 } 153 154 func (i *LogStream) ToLogStreamOutput() LogStreamOutput { 155 return i.ToLogStreamOutputWithContext(context.Background()) 156 } 157 158 func (i *LogStream) ToLogStreamOutputWithContext(ctx context.Context) LogStreamOutput { 159 return pulumi.ToOutputWithContext(ctx, i).(LogStreamOutput) 160 } 161 162 // LogStreamArrayInput is an input type that accepts LogStreamArray and LogStreamArrayOutput values. 163 // You can construct a concrete instance of `LogStreamArrayInput` via: 164 // 165 // LogStreamArray{ LogStreamArgs{...} } 166 type LogStreamArrayInput interface { 167 pulumi.Input 168 169 ToLogStreamArrayOutput() LogStreamArrayOutput 170 ToLogStreamArrayOutputWithContext(context.Context) LogStreamArrayOutput 171 } 172 173 type LogStreamArray []LogStreamInput 174 175 func (LogStreamArray) ElementType() reflect.Type { 176 return reflect.TypeOf((*[]*LogStream)(nil)).Elem() 177 } 178 179 func (i LogStreamArray) ToLogStreamArrayOutput() LogStreamArrayOutput { 180 return i.ToLogStreamArrayOutputWithContext(context.Background()) 181 } 182 183 func (i LogStreamArray) ToLogStreamArrayOutputWithContext(ctx context.Context) LogStreamArrayOutput { 184 return pulumi.ToOutputWithContext(ctx, i).(LogStreamArrayOutput) 185 } 186 187 // LogStreamMapInput is an input type that accepts LogStreamMap and LogStreamMapOutput values. 188 // You can construct a concrete instance of `LogStreamMapInput` via: 189 // 190 // LogStreamMap{ "key": LogStreamArgs{...} } 191 type LogStreamMapInput interface { 192 pulumi.Input 193 194 ToLogStreamMapOutput() LogStreamMapOutput 195 ToLogStreamMapOutputWithContext(context.Context) LogStreamMapOutput 196 } 197 198 type LogStreamMap map[string]LogStreamInput 199 200 func (LogStreamMap) ElementType() reflect.Type { 201 return reflect.TypeOf((*map[string]*LogStream)(nil)).Elem() 202 } 203 204 func (i LogStreamMap) ToLogStreamMapOutput() LogStreamMapOutput { 205 return i.ToLogStreamMapOutputWithContext(context.Background()) 206 } 207 208 func (i LogStreamMap) ToLogStreamMapOutputWithContext(ctx context.Context) LogStreamMapOutput { 209 return pulumi.ToOutputWithContext(ctx, i).(LogStreamMapOutput) 210 } 211 212 type LogStreamOutput struct{ *pulumi.OutputState } 213 214 func (LogStreamOutput) ElementType() reflect.Type { 215 return reflect.TypeOf((**LogStream)(nil)).Elem() 216 } 217 218 func (o LogStreamOutput) ToLogStreamOutput() LogStreamOutput { 219 return o 220 } 221 222 func (o LogStreamOutput) ToLogStreamOutputWithContext(ctx context.Context) LogStreamOutput { 223 return o 224 } 225 226 // The Amazon Resource Name (ARN) specifying the log stream. 227 func (o LogStreamOutput) Arn() pulumi.StringOutput { 228 return o.ApplyT(func(v *LogStream) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 229 } 230 231 // The name of the log group under which the log stream is to be created. 232 func (o LogStreamOutput) LogGroupName() pulumi.StringOutput { 233 return o.ApplyT(func(v *LogStream) pulumi.StringOutput { return v.LogGroupName }).(pulumi.StringOutput) 234 } 235 236 // The name of the log stream. Must not be longer than 512 characters and must not contain `:` 237 func (o LogStreamOutput) Name() pulumi.StringOutput { 238 return o.ApplyT(func(v *LogStream) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 239 } 240 241 type LogStreamArrayOutput struct{ *pulumi.OutputState } 242 243 func (LogStreamArrayOutput) ElementType() reflect.Type { 244 return reflect.TypeOf((*[]*LogStream)(nil)).Elem() 245 } 246 247 func (o LogStreamArrayOutput) ToLogStreamArrayOutput() LogStreamArrayOutput { 248 return o 249 } 250 251 func (o LogStreamArrayOutput) ToLogStreamArrayOutputWithContext(ctx context.Context) LogStreamArrayOutput { 252 return o 253 } 254 255 func (o LogStreamArrayOutput) Index(i pulumi.IntInput) LogStreamOutput { 256 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LogStream { 257 return vs[0].([]*LogStream)[vs[1].(int)] 258 }).(LogStreamOutput) 259 } 260 261 type LogStreamMapOutput struct{ *pulumi.OutputState } 262 263 func (LogStreamMapOutput) ElementType() reflect.Type { 264 return reflect.TypeOf((*map[string]*LogStream)(nil)).Elem() 265 } 266 267 func (o LogStreamMapOutput) ToLogStreamMapOutput() LogStreamMapOutput { 268 return o 269 } 270 271 func (o LogStreamMapOutput) ToLogStreamMapOutputWithContext(ctx context.Context) LogStreamMapOutput { 272 return o 273 } 274 275 func (o LogStreamMapOutput) MapIndex(k pulumi.StringInput) LogStreamOutput { 276 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LogStream { 277 return vs[0].(map[string]*LogStream)[vs[1].(string)] 278 }).(LogStreamOutput) 279 } 280 281 func init() { 282 pulumi.RegisterInputType(reflect.TypeOf((*LogStreamInput)(nil)).Elem(), &LogStream{}) 283 pulumi.RegisterInputType(reflect.TypeOf((*LogStreamArrayInput)(nil)).Elem(), LogStreamArray{}) 284 pulumi.RegisterInputType(reflect.TypeOf((*LogStreamMapInput)(nil)).Elem(), LogStreamMap{}) 285 pulumi.RegisterOutputType(LogStreamOutput{}) 286 pulumi.RegisterOutputType(LogStreamArrayOutput{}) 287 pulumi.RegisterOutputType(LogStreamMapOutput{}) 288 }