github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/disk_attachment.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 lightsail 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 // Attaches a Lightsail disk to a Lightsail Instance 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" 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{ 34 // State: pulumi.StringRef("available"), 35 // Filters: []aws.GetAvailabilityZonesFilter{ 36 // { 37 // Name: "opt-in-status", 38 // Values: []string{ 39 // "opt-in-not-required", 40 // }, 41 // }, 42 // }, 43 // }, nil) 44 // if err != nil { 45 // return err 46 // } 47 // test, err := lightsail.NewDisk(ctx, "test", &lightsail.DiskArgs{ 48 // Name: pulumi.String("test-disk"), 49 // SizeInGb: pulumi.Int(8), 50 // AvailabilityZone: pulumi.String(available.Names[0]), 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // testInstance, err := lightsail.NewInstance(ctx, "test", &lightsail.InstanceArgs{ 56 // Name: pulumi.String("test-instance"), 57 // AvailabilityZone: pulumi.String(available.Names[0]), 58 // BlueprintId: pulumi.String("amazon_linux_2"), 59 // BundleId: pulumi.String("nano_3_0"), 60 // }) 61 // if err != nil { 62 // return err 63 // } 64 // _, err = lightsail.NewDisk_attachment(ctx, "test", &lightsail.Disk_attachmentArgs{ 65 // DiskName: test.Name, 66 // InstanceName: testInstance.Name, 67 // DiskPath: pulumi.String("/dev/xvdf"), 68 // }) 69 // if err != nil { 70 // return err 71 // } 72 // return nil 73 // }) 74 // } 75 // 76 // ``` 77 // <!--End PulumiCodeChooser --> 78 // 79 // ## Import 80 // 81 // Using `pulumi import`, import `aws_lightsail_disk` using the id attribute. For example: 82 // 83 // ```sh 84 // $ pulumi import aws:lightsail/disk_attachment:Disk_attachment test test-disk,test-instance 85 // ``` 86 type Disk_attachment struct { 87 pulumi.CustomResourceState 88 89 // The name of the Lightsail Disk. 90 DiskName pulumi.StringOutput `pulumi:"diskName"` 91 // The disk path to expose to the instance. 92 DiskPath pulumi.StringOutput `pulumi:"diskPath"` 93 // The name of the Lightsail Instance to attach to. 94 InstanceName pulumi.StringOutput `pulumi:"instanceName"` 95 } 96 97 // NewDisk_attachment registers a new resource with the given unique name, arguments, and options. 98 func NewDisk_attachment(ctx *pulumi.Context, 99 name string, args *Disk_attachmentArgs, opts ...pulumi.ResourceOption) (*Disk_attachment, error) { 100 if args == nil { 101 return nil, errors.New("missing one or more required arguments") 102 } 103 104 if args.DiskName == nil { 105 return nil, errors.New("invalid value for required argument 'DiskName'") 106 } 107 if args.DiskPath == nil { 108 return nil, errors.New("invalid value for required argument 'DiskPath'") 109 } 110 if args.InstanceName == nil { 111 return nil, errors.New("invalid value for required argument 'InstanceName'") 112 } 113 opts = internal.PkgResourceDefaultOpts(opts) 114 var resource Disk_attachment 115 err := ctx.RegisterResource("aws:lightsail/disk_attachment:Disk_attachment", name, args, &resource, opts...) 116 if err != nil { 117 return nil, err 118 } 119 return &resource, nil 120 } 121 122 // GetDisk_attachment gets an existing Disk_attachment resource's state with the given name, ID, and optional 123 // state properties that are used to uniquely qualify the lookup (nil if not required). 124 func GetDisk_attachment(ctx *pulumi.Context, 125 name string, id pulumi.IDInput, state *Disk_attachmentState, opts ...pulumi.ResourceOption) (*Disk_attachment, error) { 126 var resource Disk_attachment 127 err := ctx.ReadResource("aws:lightsail/disk_attachment:Disk_attachment", name, id, state, &resource, opts...) 128 if err != nil { 129 return nil, err 130 } 131 return &resource, nil 132 } 133 134 // Input properties used for looking up and filtering Disk_attachment resources. 135 type disk_attachmentState struct { 136 // The name of the Lightsail Disk. 137 DiskName *string `pulumi:"diskName"` 138 // The disk path to expose to the instance. 139 DiskPath *string `pulumi:"diskPath"` 140 // The name of the Lightsail Instance to attach to. 141 InstanceName *string `pulumi:"instanceName"` 142 } 143 144 type Disk_attachmentState struct { 145 // The name of the Lightsail Disk. 146 DiskName pulumi.StringPtrInput 147 // The disk path to expose to the instance. 148 DiskPath pulumi.StringPtrInput 149 // The name of the Lightsail Instance to attach to. 150 InstanceName pulumi.StringPtrInput 151 } 152 153 func (Disk_attachmentState) ElementType() reflect.Type { 154 return reflect.TypeOf((*disk_attachmentState)(nil)).Elem() 155 } 156 157 type disk_attachmentArgs struct { 158 // The name of the Lightsail Disk. 159 DiskName string `pulumi:"diskName"` 160 // The disk path to expose to the instance. 161 DiskPath string `pulumi:"diskPath"` 162 // The name of the Lightsail Instance to attach to. 163 InstanceName string `pulumi:"instanceName"` 164 } 165 166 // The set of arguments for constructing a Disk_attachment resource. 167 type Disk_attachmentArgs struct { 168 // The name of the Lightsail Disk. 169 DiskName pulumi.StringInput 170 // The disk path to expose to the instance. 171 DiskPath pulumi.StringInput 172 // The name of the Lightsail Instance to attach to. 173 InstanceName pulumi.StringInput 174 } 175 176 func (Disk_attachmentArgs) ElementType() reflect.Type { 177 return reflect.TypeOf((*disk_attachmentArgs)(nil)).Elem() 178 } 179 180 type Disk_attachmentInput interface { 181 pulumi.Input 182 183 ToDisk_attachmentOutput() Disk_attachmentOutput 184 ToDisk_attachmentOutputWithContext(ctx context.Context) Disk_attachmentOutput 185 } 186 187 func (*Disk_attachment) ElementType() reflect.Type { 188 return reflect.TypeOf((**Disk_attachment)(nil)).Elem() 189 } 190 191 func (i *Disk_attachment) ToDisk_attachmentOutput() Disk_attachmentOutput { 192 return i.ToDisk_attachmentOutputWithContext(context.Background()) 193 } 194 195 func (i *Disk_attachment) ToDisk_attachmentOutputWithContext(ctx context.Context) Disk_attachmentOutput { 196 return pulumi.ToOutputWithContext(ctx, i).(Disk_attachmentOutput) 197 } 198 199 // Disk_attachmentArrayInput is an input type that accepts Disk_attachmentArray and Disk_attachmentArrayOutput values. 200 // You can construct a concrete instance of `Disk_attachmentArrayInput` via: 201 // 202 // Disk_attachmentArray{ Disk_attachmentArgs{...} } 203 type Disk_attachmentArrayInput interface { 204 pulumi.Input 205 206 ToDisk_attachmentArrayOutput() Disk_attachmentArrayOutput 207 ToDisk_attachmentArrayOutputWithContext(context.Context) Disk_attachmentArrayOutput 208 } 209 210 type Disk_attachmentArray []Disk_attachmentInput 211 212 func (Disk_attachmentArray) ElementType() reflect.Type { 213 return reflect.TypeOf((*[]*Disk_attachment)(nil)).Elem() 214 } 215 216 func (i Disk_attachmentArray) ToDisk_attachmentArrayOutput() Disk_attachmentArrayOutput { 217 return i.ToDisk_attachmentArrayOutputWithContext(context.Background()) 218 } 219 220 func (i Disk_attachmentArray) ToDisk_attachmentArrayOutputWithContext(ctx context.Context) Disk_attachmentArrayOutput { 221 return pulumi.ToOutputWithContext(ctx, i).(Disk_attachmentArrayOutput) 222 } 223 224 // Disk_attachmentMapInput is an input type that accepts Disk_attachmentMap and Disk_attachmentMapOutput values. 225 // You can construct a concrete instance of `Disk_attachmentMapInput` via: 226 // 227 // Disk_attachmentMap{ "key": Disk_attachmentArgs{...} } 228 type Disk_attachmentMapInput interface { 229 pulumi.Input 230 231 ToDisk_attachmentMapOutput() Disk_attachmentMapOutput 232 ToDisk_attachmentMapOutputWithContext(context.Context) Disk_attachmentMapOutput 233 } 234 235 type Disk_attachmentMap map[string]Disk_attachmentInput 236 237 func (Disk_attachmentMap) ElementType() reflect.Type { 238 return reflect.TypeOf((*map[string]*Disk_attachment)(nil)).Elem() 239 } 240 241 func (i Disk_attachmentMap) ToDisk_attachmentMapOutput() Disk_attachmentMapOutput { 242 return i.ToDisk_attachmentMapOutputWithContext(context.Background()) 243 } 244 245 func (i Disk_attachmentMap) ToDisk_attachmentMapOutputWithContext(ctx context.Context) Disk_attachmentMapOutput { 246 return pulumi.ToOutputWithContext(ctx, i).(Disk_attachmentMapOutput) 247 } 248 249 type Disk_attachmentOutput struct{ *pulumi.OutputState } 250 251 func (Disk_attachmentOutput) ElementType() reflect.Type { 252 return reflect.TypeOf((**Disk_attachment)(nil)).Elem() 253 } 254 255 func (o Disk_attachmentOutput) ToDisk_attachmentOutput() Disk_attachmentOutput { 256 return o 257 } 258 259 func (o Disk_attachmentOutput) ToDisk_attachmentOutputWithContext(ctx context.Context) Disk_attachmentOutput { 260 return o 261 } 262 263 // The name of the Lightsail Disk. 264 func (o Disk_attachmentOutput) DiskName() pulumi.StringOutput { 265 return o.ApplyT(func(v *Disk_attachment) pulumi.StringOutput { return v.DiskName }).(pulumi.StringOutput) 266 } 267 268 // The disk path to expose to the instance. 269 func (o Disk_attachmentOutput) DiskPath() pulumi.StringOutput { 270 return o.ApplyT(func(v *Disk_attachment) pulumi.StringOutput { return v.DiskPath }).(pulumi.StringOutput) 271 } 272 273 // The name of the Lightsail Instance to attach to. 274 func (o Disk_attachmentOutput) InstanceName() pulumi.StringOutput { 275 return o.ApplyT(func(v *Disk_attachment) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput) 276 } 277 278 type Disk_attachmentArrayOutput struct{ *pulumi.OutputState } 279 280 func (Disk_attachmentArrayOutput) ElementType() reflect.Type { 281 return reflect.TypeOf((*[]*Disk_attachment)(nil)).Elem() 282 } 283 284 func (o Disk_attachmentArrayOutput) ToDisk_attachmentArrayOutput() Disk_attachmentArrayOutput { 285 return o 286 } 287 288 func (o Disk_attachmentArrayOutput) ToDisk_attachmentArrayOutputWithContext(ctx context.Context) Disk_attachmentArrayOutput { 289 return o 290 } 291 292 func (o Disk_attachmentArrayOutput) Index(i pulumi.IntInput) Disk_attachmentOutput { 293 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Disk_attachment { 294 return vs[0].([]*Disk_attachment)[vs[1].(int)] 295 }).(Disk_attachmentOutput) 296 } 297 298 type Disk_attachmentMapOutput struct{ *pulumi.OutputState } 299 300 func (Disk_attachmentMapOutput) ElementType() reflect.Type { 301 return reflect.TypeOf((*map[string]*Disk_attachment)(nil)).Elem() 302 } 303 304 func (o Disk_attachmentMapOutput) ToDisk_attachmentMapOutput() Disk_attachmentMapOutput { 305 return o 306 } 307 308 func (o Disk_attachmentMapOutput) ToDisk_attachmentMapOutputWithContext(ctx context.Context) Disk_attachmentMapOutput { 309 return o 310 } 311 312 func (o Disk_attachmentMapOutput) MapIndex(k pulumi.StringInput) Disk_attachmentOutput { 313 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Disk_attachment { 314 return vs[0].(map[string]*Disk_attachment)[vs[1].(string)] 315 }).(Disk_attachmentOutput) 316 } 317 318 func init() { 319 pulumi.RegisterInputType(reflect.TypeOf((*Disk_attachmentInput)(nil)).Elem(), &Disk_attachment{}) 320 pulumi.RegisterInputType(reflect.TypeOf((*Disk_attachmentArrayInput)(nil)).Elem(), Disk_attachmentArray{}) 321 pulumi.RegisterInputType(reflect.TypeOf((*Disk_attachmentMapInput)(nil)).Elem(), Disk_attachmentMap{}) 322 pulumi.RegisterOutputType(Disk_attachmentOutput{}) 323 pulumi.RegisterOutputType(Disk_attachmentArrayOutput{}) 324 pulumi.RegisterOutputType(Disk_attachmentMapOutput{}) 325 }