github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/efs/fileSystemPolicy.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 efs 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 Elastic File System (EFS) File System Policy 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/efs" 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // fs, err := efs.NewFileSystem(ctx, "fs", &efs.FileSystemArgs{ 34 // CreationToken: pulumi.String("my-product"), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // policy := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{ 40 // Statements: iam.GetPolicyDocumentStatementArray{ 41 // &iam.GetPolicyDocumentStatementArgs{ 42 // Sid: pulumi.String("ExampleStatement01"), 43 // Effect: pulumi.String("Allow"), 44 // Principals: iam.GetPolicyDocumentStatementPrincipalArray{ 45 // &iam.GetPolicyDocumentStatementPrincipalArgs{ 46 // Type: pulumi.String("AWS"), 47 // Identifiers: pulumi.StringArray{ 48 // pulumi.String("*"), 49 // }, 50 // }, 51 // }, 52 // Actions: pulumi.StringArray{ 53 // pulumi.String("elasticfilesystem:ClientMount"), 54 // pulumi.String("elasticfilesystem:ClientWrite"), 55 // }, 56 // Resources: pulumi.StringArray{ 57 // fs.Arn, 58 // }, 59 // Conditions: iam.GetPolicyDocumentStatementConditionArray{ 60 // &iam.GetPolicyDocumentStatementConditionArgs{ 61 // Test: pulumi.String("Bool"), 62 // Variable: pulumi.String("aws:SecureTransport"), 63 // Values: pulumi.StringArray{ 64 // pulumi.String("true"), 65 // }, 66 // }, 67 // }, 68 // }, 69 // }, 70 // }, nil) 71 // _, err = efs.NewFileSystemPolicy(ctx, "policy", &efs.FileSystemPolicyArgs{ 72 // FileSystemId: fs.ID(), 73 // Policy: policy.ApplyT(func(policy iam.GetPolicyDocumentResult) (*string, error) { 74 // return &policy.Json, nil 75 // }).(pulumi.StringPtrOutput), 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // return nil 81 // }) 82 // } 83 // 84 // ``` 85 // <!--End PulumiCodeChooser --> 86 // 87 // ## Import 88 // 89 // Using `pulumi import`, import the EFS file system policies using the `id`. For example: 90 // 91 // ```sh 92 // $ pulumi import aws:efs/fileSystemPolicy:FileSystemPolicy foo fs-6fa144c6 93 // ``` 94 type FileSystemPolicy struct { 95 pulumi.CustomResourceState 96 97 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 98 BypassPolicyLockoutSafetyCheck pulumi.BoolPtrOutput `pulumi:"bypassPolicyLockoutSafetyCheck"` 99 // The ID of the EFS file system. 100 FileSystemId pulumi.StringOutput `pulumi:"fileSystemId"` 101 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 102 // 103 // The following arguments are optional: 104 Policy pulumi.StringOutput `pulumi:"policy"` 105 } 106 107 // NewFileSystemPolicy registers a new resource with the given unique name, arguments, and options. 108 func NewFileSystemPolicy(ctx *pulumi.Context, 109 name string, args *FileSystemPolicyArgs, opts ...pulumi.ResourceOption) (*FileSystemPolicy, error) { 110 if args == nil { 111 return nil, errors.New("missing one or more required arguments") 112 } 113 114 if args.FileSystemId == nil { 115 return nil, errors.New("invalid value for required argument 'FileSystemId'") 116 } 117 if args.Policy == nil { 118 return nil, errors.New("invalid value for required argument 'Policy'") 119 } 120 opts = internal.PkgResourceDefaultOpts(opts) 121 var resource FileSystemPolicy 122 err := ctx.RegisterResource("aws:efs/fileSystemPolicy:FileSystemPolicy", name, args, &resource, opts...) 123 if err != nil { 124 return nil, err 125 } 126 return &resource, nil 127 } 128 129 // GetFileSystemPolicy gets an existing FileSystemPolicy resource's state with the given name, ID, and optional 130 // state properties that are used to uniquely qualify the lookup (nil if not required). 131 func GetFileSystemPolicy(ctx *pulumi.Context, 132 name string, id pulumi.IDInput, state *FileSystemPolicyState, opts ...pulumi.ResourceOption) (*FileSystemPolicy, error) { 133 var resource FileSystemPolicy 134 err := ctx.ReadResource("aws:efs/fileSystemPolicy:FileSystemPolicy", name, id, state, &resource, opts...) 135 if err != nil { 136 return nil, err 137 } 138 return &resource, nil 139 } 140 141 // Input properties used for looking up and filtering FileSystemPolicy resources. 142 type fileSystemPolicyState struct { 143 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 144 BypassPolicyLockoutSafetyCheck *bool `pulumi:"bypassPolicyLockoutSafetyCheck"` 145 // The ID of the EFS file system. 146 FileSystemId *string `pulumi:"fileSystemId"` 147 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 148 // 149 // The following arguments are optional: 150 Policy *string `pulumi:"policy"` 151 } 152 153 type FileSystemPolicyState struct { 154 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 155 BypassPolicyLockoutSafetyCheck pulumi.BoolPtrInput 156 // The ID of the EFS file system. 157 FileSystemId pulumi.StringPtrInput 158 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 159 // 160 // The following arguments are optional: 161 Policy pulumi.StringPtrInput 162 } 163 164 func (FileSystemPolicyState) ElementType() reflect.Type { 165 return reflect.TypeOf((*fileSystemPolicyState)(nil)).Elem() 166 } 167 168 type fileSystemPolicyArgs struct { 169 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 170 BypassPolicyLockoutSafetyCheck *bool `pulumi:"bypassPolicyLockoutSafetyCheck"` 171 // The ID of the EFS file system. 172 FileSystemId string `pulumi:"fileSystemId"` 173 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 174 // 175 // The following arguments are optional: 176 Policy string `pulumi:"policy"` 177 } 178 179 // The set of arguments for constructing a FileSystemPolicy resource. 180 type FileSystemPolicyArgs struct { 181 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 182 BypassPolicyLockoutSafetyCheck pulumi.BoolPtrInput 183 // The ID of the EFS file system. 184 FileSystemId pulumi.StringInput 185 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 186 // 187 // The following arguments are optional: 188 Policy pulumi.StringInput 189 } 190 191 func (FileSystemPolicyArgs) ElementType() reflect.Type { 192 return reflect.TypeOf((*fileSystemPolicyArgs)(nil)).Elem() 193 } 194 195 type FileSystemPolicyInput interface { 196 pulumi.Input 197 198 ToFileSystemPolicyOutput() FileSystemPolicyOutput 199 ToFileSystemPolicyOutputWithContext(ctx context.Context) FileSystemPolicyOutput 200 } 201 202 func (*FileSystemPolicy) ElementType() reflect.Type { 203 return reflect.TypeOf((**FileSystemPolicy)(nil)).Elem() 204 } 205 206 func (i *FileSystemPolicy) ToFileSystemPolicyOutput() FileSystemPolicyOutput { 207 return i.ToFileSystemPolicyOutputWithContext(context.Background()) 208 } 209 210 func (i *FileSystemPolicy) ToFileSystemPolicyOutputWithContext(ctx context.Context) FileSystemPolicyOutput { 211 return pulumi.ToOutputWithContext(ctx, i).(FileSystemPolicyOutput) 212 } 213 214 // FileSystemPolicyArrayInput is an input type that accepts FileSystemPolicyArray and FileSystemPolicyArrayOutput values. 215 // You can construct a concrete instance of `FileSystemPolicyArrayInput` via: 216 // 217 // FileSystemPolicyArray{ FileSystemPolicyArgs{...} } 218 type FileSystemPolicyArrayInput interface { 219 pulumi.Input 220 221 ToFileSystemPolicyArrayOutput() FileSystemPolicyArrayOutput 222 ToFileSystemPolicyArrayOutputWithContext(context.Context) FileSystemPolicyArrayOutput 223 } 224 225 type FileSystemPolicyArray []FileSystemPolicyInput 226 227 func (FileSystemPolicyArray) ElementType() reflect.Type { 228 return reflect.TypeOf((*[]*FileSystemPolicy)(nil)).Elem() 229 } 230 231 func (i FileSystemPolicyArray) ToFileSystemPolicyArrayOutput() FileSystemPolicyArrayOutput { 232 return i.ToFileSystemPolicyArrayOutputWithContext(context.Background()) 233 } 234 235 func (i FileSystemPolicyArray) ToFileSystemPolicyArrayOutputWithContext(ctx context.Context) FileSystemPolicyArrayOutput { 236 return pulumi.ToOutputWithContext(ctx, i).(FileSystemPolicyArrayOutput) 237 } 238 239 // FileSystemPolicyMapInput is an input type that accepts FileSystemPolicyMap and FileSystemPolicyMapOutput values. 240 // You can construct a concrete instance of `FileSystemPolicyMapInput` via: 241 // 242 // FileSystemPolicyMap{ "key": FileSystemPolicyArgs{...} } 243 type FileSystemPolicyMapInput interface { 244 pulumi.Input 245 246 ToFileSystemPolicyMapOutput() FileSystemPolicyMapOutput 247 ToFileSystemPolicyMapOutputWithContext(context.Context) FileSystemPolicyMapOutput 248 } 249 250 type FileSystemPolicyMap map[string]FileSystemPolicyInput 251 252 func (FileSystemPolicyMap) ElementType() reflect.Type { 253 return reflect.TypeOf((*map[string]*FileSystemPolicy)(nil)).Elem() 254 } 255 256 func (i FileSystemPolicyMap) ToFileSystemPolicyMapOutput() FileSystemPolicyMapOutput { 257 return i.ToFileSystemPolicyMapOutputWithContext(context.Background()) 258 } 259 260 func (i FileSystemPolicyMap) ToFileSystemPolicyMapOutputWithContext(ctx context.Context) FileSystemPolicyMapOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(FileSystemPolicyMapOutput) 262 } 263 264 type FileSystemPolicyOutput struct{ *pulumi.OutputState } 265 266 func (FileSystemPolicyOutput) ElementType() reflect.Type { 267 return reflect.TypeOf((**FileSystemPolicy)(nil)).Elem() 268 } 269 270 func (o FileSystemPolicyOutput) ToFileSystemPolicyOutput() FileSystemPolicyOutput { 271 return o 272 } 273 274 func (o FileSystemPolicyOutput) ToFileSystemPolicyOutputWithContext(ctx context.Context) FileSystemPolicyOutput { 275 return o 276 } 277 278 // A flag to indicate whether to bypass the `efs.FileSystemPolicy` lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future `PutFileSystemPolicy` requests on the file system. Set `bypassPolicyLockoutSafetyCheck` to `true` only when you intend to prevent the principal that is making the request from making a subsequent `PutFileSystemPolicy` request on the file system. The default value is `false`. 279 func (o FileSystemPolicyOutput) BypassPolicyLockoutSafetyCheck() pulumi.BoolPtrOutput { 280 return o.ApplyT(func(v *FileSystemPolicy) pulumi.BoolPtrOutput { return v.BypassPolicyLockoutSafetyCheck }).(pulumi.BoolPtrOutput) 281 } 282 283 // The ID of the EFS file system. 284 func (o FileSystemPolicyOutput) FileSystemId() pulumi.StringOutput { 285 return o.ApplyT(func(v *FileSystemPolicy) pulumi.StringOutput { return v.FileSystemId }).(pulumi.StringOutput) 286 } 287 288 // The JSON formatted file system policy for the EFS file system. see [Docs](https://docs.aws.amazon.com/efs/latest/ug/access-control-overview.html#access-control-manage-access-intro-resource-policies) for more info. 289 // 290 // The following arguments are optional: 291 func (o FileSystemPolicyOutput) Policy() pulumi.StringOutput { 292 return o.ApplyT(func(v *FileSystemPolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput) 293 } 294 295 type FileSystemPolicyArrayOutput struct{ *pulumi.OutputState } 296 297 func (FileSystemPolicyArrayOutput) ElementType() reflect.Type { 298 return reflect.TypeOf((*[]*FileSystemPolicy)(nil)).Elem() 299 } 300 301 func (o FileSystemPolicyArrayOutput) ToFileSystemPolicyArrayOutput() FileSystemPolicyArrayOutput { 302 return o 303 } 304 305 func (o FileSystemPolicyArrayOutput) ToFileSystemPolicyArrayOutputWithContext(ctx context.Context) FileSystemPolicyArrayOutput { 306 return o 307 } 308 309 func (o FileSystemPolicyArrayOutput) Index(i pulumi.IntInput) FileSystemPolicyOutput { 310 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FileSystemPolicy { 311 return vs[0].([]*FileSystemPolicy)[vs[1].(int)] 312 }).(FileSystemPolicyOutput) 313 } 314 315 type FileSystemPolicyMapOutput struct{ *pulumi.OutputState } 316 317 func (FileSystemPolicyMapOutput) ElementType() reflect.Type { 318 return reflect.TypeOf((*map[string]*FileSystemPolicy)(nil)).Elem() 319 } 320 321 func (o FileSystemPolicyMapOutput) ToFileSystemPolicyMapOutput() FileSystemPolicyMapOutput { 322 return o 323 } 324 325 func (o FileSystemPolicyMapOutput) ToFileSystemPolicyMapOutputWithContext(ctx context.Context) FileSystemPolicyMapOutput { 326 return o 327 } 328 329 func (o FileSystemPolicyMapOutput) MapIndex(k pulumi.StringInput) FileSystemPolicyOutput { 330 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FileSystemPolicy { 331 return vs[0].(map[string]*FileSystemPolicy)[vs[1].(string)] 332 }).(FileSystemPolicyOutput) 333 } 334 335 func init() { 336 pulumi.RegisterInputType(reflect.TypeOf((*FileSystemPolicyInput)(nil)).Elem(), &FileSystemPolicy{}) 337 pulumi.RegisterInputType(reflect.TypeOf((*FileSystemPolicyArrayInput)(nil)).Elem(), FileSystemPolicyArray{}) 338 pulumi.RegisterInputType(reflect.TypeOf((*FileSystemPolicyMapInput)(nil)).Elem(), FileSystemPolicyMap{}) 339 pulumi.RegisterOutputType(FileSystemPolicyOutput{}) 340 pulumi.RegisterOutputType(FileSystemPolicyArrayOutput{}) 341 pulumi.RegisterOutputType(FileSystemPolicyMapOutput{}) 342 }