github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/storagegateway/cache.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 storagegateway 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 // Manages an AWS Storage Gateway cache. 16 // 17 // > **NOTE:** The Storage Gateway API provides no method to remove a cache disk. Destroying this resource does not perform any Storage Gateway actions. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/storagegateway" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := storagegateway.NewCache(ctx, "example", &storagegateway.CacheArgs{ 35 // DiskId: pulumi.Any(exampleAwsStoragegatewayLocalDisk.Id), 36 // GatewayArn: pulumi.Any(exampleAwsStoragegatewayGateway.Arn), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // ## Import 49 // 50 // Using `pulumi import`, import `aws_storagegateway_cache` using the gateway Amazon Resource Name (ARN) and local disk identifier separated with a colon (`:`). For example: 51 // 52 // ```sh 53 // $ pulumi import aws:storagegateway/cache:Cache example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678:pci-0000:03:00.0-scsi-0:0:0:0 54 // ``` 55 type Cache struct { 56 pulumi.CustomResourceState 57 58 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 59 DiskId pulumi.StringOutput `pulumi:"diskId"` 60 // The Amazon Resource Name (ARN) of the gateway. 61 GatewayArn pulumi.StringOutput `pulumi:"gatewayArn"` 62 } 63 64 // NewCache registers a new resource with the given unique name, arguments, and options. 65 func NewCache(ctx *pulumi.Context, 66 name string, args *CacheArgs, opts ...pulumi.ResourceOption) (*Cache, error) { 67 if args == nil { 68 return nil, errors.New("missing one or more required arguments") 69 } 70 71 if args.DiskId == nil { 72 return nil, errors.New("invalid value for required argument 'DiskId'") 73 } 74 if args.GatewayArn == nil { 75 return nil, errors.New("invalid value for required argument 'GatewayArn'") 76 } 77 opts = internal.PkgResourceDefaultOpts(opts) 78 var resource Cache 79 err := ctx.RegisterResource("aws:storagegateway/cache:Cache", name, args, &resource, opts...) 80 if err != nil { 81 return nil, err 82 } 83 return &resource, nil 84 } 85 86 // GetCache gets an existing Cache resource's state with the given name, ID, and optional 87 // state properties that are used to uniquely qualify the lookup (nil if not required). 88 func GetCache(ctx *pulumi.Context, 89 name string, id pulumi.IDInput, state *CacheState, opts ...pulumi.ResourceOption) (*Cache, error) { 90 var resource Cache 91 err := ctx.ReadResource("aws:storagegateway/cache:Cache", name, id, state, &resource, opts...) 92 if err != nil { 93 return nil, err 94 } 95 return &resource, nil 96 } 97 98 // Input properties used for looking up and filtering Cache resources. 99 type cacheState struct { 100 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 101 DiskId *string `pulumi:"diskId"` 102 // The Amazon Resource Name (ARN) of the gateway. 103 GatewayArn *string `pulumi:"gatewayArn"` 104 } 105 106 type CacheState struct { 107 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 108 DiskId pulumi.StringPtrInput 109 // The Amazon Resource Name (ARN) of the gateway. 110 GatewayArn pulumi.StringPtrInput 111 } 112 113 func (CacheState) ElementType() reflect.Type { 114 return reflect.TypeOf((*cacheState)(nil)).Elem() 115 } 116 117 type cacheArgs struct { 118 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 119 DiskId string `pulumi:"diskId"` 120 // The Amazon Resource Name (ARN) of the gateway. 121 GatewayArn string `pulumi:"gatewayArn"` 122 } 123 124 // The set of arguments for constructing a Cache resource. 125 type CacheArgs struct { 126 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 127 DiskId pulumi.StringInput 128 // The Amazon Resource Name (ARN) of the gateway. 129 GatewayArn pulumi.StringInput 130 } 131 132 func (CacheArgs) ElementType() reflect.Type { 133 return reflect.TypeOf((*cacheArgs)(nil)).Elem() 134 } 135 136 type CacheInput interface { 137 pulumi.Input 138 139 ToCacheOutput() CacheOutput 140 ToCacheOutputWithContext(ctx context.Context) CacheOutput 141 } 142 143 func (*Cache) ElementType() reflect.Type { 144 return reflect.TypeOf((**Cache)(nil)).Elem() 145 } 146 147 func (i *Cache) ToCacheOutput() CacheOutput { 148 return i.ToCacheOutputWithContext(context.Background()) 149 } 150 151 func (i *Cache) ToCacheOutputWithContext(ctx context.Context) CacheOutput { 152 return pulumi.ToOutputWithContext(ctx, i).(CacheOutput) 153 } 154 155 // CacheArrayInput is an input type that accepts CacheArray and CacheArrayOutput values. 156 // You can construct a concrete instance of `CacheArrayInput` via: 157 // 158 // CacheArray{ CacheArgs{...} } 159 type CacheArrayInput interface { 160 pulumi.Input 161 162 ToCacheArrayOutput() CacheArrayOutput 163 ToCacheArrayOutputWithContext(context.Context) CacheArrayOutput 164 } 165 166 type CacheArray []CacheInput 167 168 func (CacheArray) ElementType() reflect.Type { 169 return reflect.TypeOf((*[]*Cache)(nil)).Elem() 170 } 171 172 func (i CacheArray) ToCacheArrayOutput() CacheArrayOutput { 173 return i.ToCacheArrayOutputWithContext(context.Background()) 174 } 175 176 func (i CacheArray) ToCacheArrayOutputWithContext(ctx context.Context) CacheArrayOutput { 177 return pulumi.ToOutputWithContext(ctx, i).(CacheArrayOutput) 178 } 179 180 // CacheMapInput is an input type that accepts CacheMap and CacheMapOutput values. 181 // You can construct a concrete instance of `CacheMapInput` via: 182 // 183 // CacheMap{ "key": CacheArgs{...} } 184 type CacheMapInput interface { 185 pulumi.Input 186 187 ToCacheMapOutput() CacheMapOutput 188 ToCacheMapOutputWithContext(context.Context) CacheMapOutput 189 } 190 191 type CacheMap map[string]CacheInput 192 193 func (CacheMap) ElementType() reflect.Type { 194 return reflect.TypeOf((*map[string]*Cache)(nil)).Elem() 195 } 196 197 func (i CacheMap) ToCacheMapOutput() CacheMapOutput { 198 return i.ToCacheMapOutputWithContext(context.Background()) 199 } 200 201 func (i CacheMap) ToCacheMapOutputWithContext(ctx context.Context) CacheMapOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(CacheMapOutput) 203 } 204 205 type CacheOutput struct{ *pulumi.OutputState } 206 207 func (CacheOutput) ElementType() reflect.Type { 208 return reflect.TypeOf((**Cache)(nil)).Elem() 209 } 210 211 func (o CacheOutput) ToCacheOutput() CacheOutput { 212 return o 213 } 214 215 func (o CacheOutput) ToCacheOutputWithContext(ctx context.Context) CacheOutput { 216 return o 217 } 218 219 // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. 220 func (o CacheOutput) DiskId() pulumi.StringOutput { 221 return o.ApplyT(func(v *Cache) pulumi.StringOutput { return v.DiskId }).(pulumi.StringOutput) 222 } 223 224 // The Amazon Resource Name (ARN) of the gateway. 225 func (o CacheOutput) GatewayArn() pulumi.StringOutput { 226 return o.ApplyT(func(v *Cache) pulumi.StringOutput { return v.GatewayArn }).(pulumi.StringOutput) 227 } 228 229 type CacheArrayOutput struct{ *pulumi.OutputState } 230 231 func (CacheArrayOutput) ElementType() reflect.Type { 232 return reflect.TypeOf((*[]*Cache)(nil)).Elem() 233 } 234 235 func (o CacheArrayOutput) ToCacheArrayOutput() CacheArrayOutput { 236 return o 237 } 238 239 func (o CacheArrayOutput) ToCacheArrayOutputWithContext(ctx context.Context) CacheArrayOutput { 240 return o 241 } 242 243 func (o CacheArrayOutput) Index(i pulumi.IntInput) CacheOutput { 244 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Cache { 245 return vs[0].([]*Cache)[vs[1].(int)] 246 }).(CacheOutput) 247 } 248 249 type CacheMapOutput struct{ *pulumi.OutputState } 250 251 func (CacheMapOutput) ElementType() reflect.Type { 252 return reflect.TypeOf((*map[string]*Cache)(nil)).Elem() 253 } 254 255 func (o CacheMapOutput) ToCacheMapOutput() CacheMapOutput { 256 return o 257 } 258 259 func (o CacheMapOutput) ToCacheMapOutputWithContext(ctx context.Context) CacheMapOutput { 260 return o 261 } 262 263 func (o CacheMapOutput) MapIndex(k pulumi.StringInput) CacheOutput { 264 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Cache { 265 return vs[0].(map[string]*Cache)[vs[1].(string)] 266 }).(CacheOutput) 267 } 268 269 func init() { 270 pulumi.RegisterInputType(reflect.TypeOf((*CacheInput)(nil)).Elem(), &Cache{}) 271 pulumi.RegisterInputType(reflect.TypeOf((*CacheArrayInput)(nil)).Elem(), CacheArray{}) 272 pulumi.RegisterInputType(reflect.TypeOf((*CacheMapInput)(nil)).Elem(), CacheMap{}) 273 pulumi.RegisterOutputType(CacheOutput{}) 274 pulumi.RegisterOutputType(CacheArrayOutput{}) 275 pulumi.RegisterOutputType(CacheMapOutput{}) 276 }