github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/opsworks/permission.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 opsworks
     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 OpsWorks permission 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/opsworks"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := opsworks.NewPermission(ctx, "my_stack_permission", &opsworks.PermissionArgs{
    33  //				AllowSsh:  pulumi.Bool(true),
    34  //				AllowSudo: pulumi.Bool(true),
    35  //				Level:     pulumi.String("iam_only"),
    36  //				UserArn:   pulumi.Any(user.Arn),
    37  //				StackId:   pulumi.Any(stack.Id),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  type Permission struct {
    49  	pulumi.CustomResourceState
    50  
    51  	// Whether the user is allowed to use SSH to communicate with the instance
    52  	AllowSsh pulumi.BoolOutput `pulumi:"allowSsh"`
    53  	// Whether the user is allowed to use sudo to elevate privileges
    54  	AllowSudo pulumi.BoolOutput `pulumi:"allowSudo"`
    55  	// The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
    56  	Level pulumi.StringOutput `pulumi:"level"`
    57  	// The stack to set the permissions for
    58  	StackId pulumi.StringOutput `pulumi:"stackId"`
    59  	// The user's IAM ARN to set permissions for
    60  	UserArn pulumi.StringOutput `pulumi:"userArn"`
    61  }
    62  
    63  // NewPermission registers a new resource with the given unique name, arguments, and options.
    64  func NewPermission(ctx *pulumi.Context,
    65  	name string, args *PermissionArgs, opts ...pulumi.ResourceOption) (*Permission, error) {
    66  	if args == nil {
    67  		return nil, errors.New("missing one or more required arguments")
    68  	}
    69  
    70  	if args.StackId == nil {
    71  		return nil, errors.New("invalid value for required argument 'StackId'")
    72  	}
    73  	if args.UserArn == nil {
    74  		return nil, errors.New("invalid value for required argument 'UserArn'")
    75  	}
    76  	opts = internal.PkgResourceDefaultOpts(opts)
    77  	var resource Permission
    78  	err := ctx.RegisterResource("aws:opsworks/permission:Permission", name, args, &resource, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	return &resource, nil
    83  }
    84  
    85  // GetPermission gets an existing Permission resource's state with the given name, ID, and optional
    86  // state properties that are used to uniquely qualify the lookup (nil if not required).
    87  func GetPermission(ctx *pulumi.Context,
    88  	name string, id pulumi.IDInput, state *PermissionState, opts ...pulumi.ResourceOption) (*Permission, error) {
    89  	var resource Permission
    90  	err := ctx.ReadResource("aws:opsworks/permission:Permission", name, id, state, &resource, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return &resource, nil
    95  }
    96  
    97  // Input properties used for looking up and filtering Permission resources.
    98  type permissionState struct {
    99  	// Whether the user is allowed to use SSH to communicate with the instance
   100  	AllowSsh *bool `pulumi:"allowSsh"`
   101  	// Whether the user is allowed to use sudo to elevate privileges
   102  	AllowSudo *bool `pulumi:"allowSudo"`
   103  	// The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
   104  	Level *string `pulumi:"level"`
   105  	// The stack to set the permissions for
   106  	StackId *string `pulumi:"stackId"`
   107  	// The user's IAM ARN to set permissions for
   108  	UserArn *string `pulumi:"userArn"`
   109  }
   110  
   111  type PermissionState struct {
   112  	// Whether the user is allowed to use SSH to communicate with the instance
   113  	AllowSsh pulumi.BoolPtrInput
   114  	// Whether the user is allowed to use sudo to elevate privileges
   115  	AllowSudo pulumi.BoolPtrInput
   116  	// The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
   117  	Level pulumi.StringPtrInput
   118  	// The stack to set the permissions for
   119  	StackId pulumi.StringPtrInput
   120  	// The user's IAM ARN to set permissions for
   121  	UserArn pulumi.StringPtrInput
   122  }
   123  
   124  func (PermissionState) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*permissionState)(nil)).Elem()
   126  }
   127  
   128  type permissionArgs struct {
   129  	// Whether the user is allowed to use SSH to communicate with the instance
   130  	AllowSsh *bool `pulumi:"allowSsh"`
   131  	// Whether the user is allowed to use sudo to elevate privileges
   132  	AllowSudo *bool `pulumi:"allowSudo"`
   133  	// The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
   134  	Level *string `pulumi:"level"`
   135  	// The stack to set the permissions for
   136  	StackId string `pulumi:"stackId"`
   137  	// The user's IAM ARN to set permissions for
   138  	UserArn string `pulumi:"userArn"`
   139  }
   140  
   141  // The set of arguments for constructing a Permission resource.
   142  type PermissionArgs struct {
   143  	// Whether the user is allowed to use SSH to communicate with the instance
   144  	AllowSsh pulumi.BoolPtrInput
   145  	// Whether the user is allowed to use sudo to elevate privileges
   146  	AllowSudo pulumi.BoolPtrInput
   147  	// The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
   148  	Level pulumi.StringPtrInput
   149  	// The stack to set the permissions for
   150  	StackId pulumi.StringInput
   151  	// The user's IAM ARN to set permissions for
   152  	UserArn pulumi.StringInput
   153  }
   154  
   155  func (PermissionArgs) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*permissionArgs)(nil)).Elem()
   157  }
   158  
   159  type PermissionInput interface {
   160  	pulumi.Input
   161  
   162  	ToPermissionOutput() PermissionOutput
   163  	ToPermissionOutputWithContext(ctx context.Context) PermissionOutput
   164  }
   165  
   166  func (*Permission) ElementType() reflect.Type {
   167  	return reflect.TypeOf((**Permission)(nil)).Elem()
   168  }
   169  
   170  func (i *Permission) ToPermissionOutput() PermissionOutput {
   171  	return i.ToPermissionOutputWithContext(context.Background())
   172  }
   173  
   174  func (i *Permission) ToPermissionOutputWithContext(ctx context.Context) PermissionOutput {
   175  	return pulumi.ToOutputWithContext(ctx, i).(PermissionOutput)
   176  }
   177  
   178  // PermissionArrayInput is an input type that accepts PermissionArray and PermissionArrayOutput values.
   179  // You can construct a concrete instance of `PermissionArrayInput` via:
   180  //
   181  //	PermissionArray{ PermissionArgs{...} }
   182  type PermissionArrayInput interface {
   183  	pulumi.Input
   184  
   185  	ToPermissionArrayOutput() PermissionArrayOutput
   186  	ToPermissionArrayOutputWithContext(context.Context) PermissionArrayOutput
   187  }
   188  
   189  type PermissionArray []PermissionInput
   190  
   191  func (PermissionArray) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*[]*Permission)(nil)).Elem()
   193  }
   194  
   195  func (i PermissionArray) ToPermissionArrayOutput() PermissionArrayOutput {
   196  	return i.ToPermissionArrayOutputWithContext(context.Background())
   197  }
   198  
   199  func (i PermissionArray) ToPermissionArrayOutputWithContext(ctx context.Context) PermissionArrayOutput {
   200  	return pulumi.ToOutputWithContext(ctx, i).(PermissionArrayOutput)
   201  }
   202  
   203  // PermissionMapInput is an input type that accepts PermissionMap and PermissionMapOutput values.
   204  // You can construct a concrete instance of `PermissionMapInput` via:
   205  //
   206  //	PermissionMap{ "key": PermissionArgs{...} }
   207  type PermissionMapInput interface {
   208  	pulumi.Input
   209  
   210  	ToPermissionMapOutput() PermissionMapOutput
   211  	ToPermissionMapOutputWithContext(context.Context) PermissionMapOutput
   212  }
   213  
   214  type PermissionMap map[string]PermissionInput
   215  
   216  func (PermissionMap) ElementType() reflect.Type {
   217  	return reflect.TypeOf((*map[string]*Permission)(nil)).Elem()
   218  }
   219  
   220  func (i PermissionMap) ToPermissionMapOutput() PermissionMapOutput {
   221  	return i.ToPermissionMapOutputWithContext(context.Background())
   222  }
   223  
   224  func (i PermissionMap) ToPermissionMapOutputWithContext(ctx context.Context) PermissionMapOutput {
   225  	return pulumi.ToOutputWithContext(ctx, i).(PermissionMapOutput)
   226  }
   227  
   228  type PermissionOutput struct{ *pulumi.OutputState }
   229  
   230  func (PermissionOutput) ElementType() reflect.Type {
   231  	return reflect.TypeOf((**Permission)(nil)).Elem()
   232  }
   233  
   234  func (o PermissionOutput) ToPermissionOutput() PermissionOutput {
   235  	return o
   236  }
   237  
   238  func (o PermissionOutput) ToPermissionOutputWithContext(ctx context.Context) PermissionOutput {
   239  	return o
   240  }
   241  
   242  // Whether the user is allowed to use SSH to communicate with the instance
   243  func (o PermissionOutput) AllowSsh() pulumi.BoolOutput {
   244  	return o.ApplyT(func(v *Permission) pulumi.BoolOutput { return v.AllowSsh }).(pulumi.BoolOutput)
   245  }
   246  
   247  // Whether the user is allowed to use sudo to elevate privileges
   248  func (o PermissionOutput) AllowSudo() pulumi.BoolOutput {
   249  	return o.ApplyT(func(v *Permission) pulumi.BoolOutput { return v.AllowSudo }).(pulumi.BoolOutput)
   250  }
   251  
   252  // The users permission level. Mus be one of `deny`, `show`, `deploy`, `manage`, `iamOnly`
   253  func (o PermissionOutput) Level() pulumi.StringOutput {
   254  	return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.Level }).(pulumi.StringOutput)
   255  }
   256  
   257  // The stack to set the permissions for
   258  func (o PermissionOutput) StackId() pulumi.StringOutput {
   259  	return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.StackId }).(pulumi.StringOutput)
   260  }
   261  
   262  // The user's IAM ARN to set permissions for
   263  func (o PermissionOutput) UserArn() pulumi.StringOutput {
   264  	return o.ApplyT(func(v *Permission) pulumi.StringOutput { return v.UserArn }).(pulumi.StringOutput)
   265  }
   266  
   267  type PermissionArrayOutput struct{ *pulumi.OutputState }
   268  
   269  func (PermissionArrayOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((*[]*Permission)(nil)).Elem()
   271  }
   272  
   273  func (o PermissionArrayOutput) ToPermissionArrayOutput() PermissionArrayOutput {
   274  	return o
   275  }
   276  
   277  func (o PermissionArrayOutput) ToPermissionArrayOutputWithContext(ctx context.Context) PermissionArrayOutput {
   278  	return o
   279  }
   280  
   281  func (o PermissionArrayOutput) Index(i pulumi.IntInput) PermissionOutput {
   282  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Permission {
   283  		return vs[0].([]*Permission)[vs[1].(int)]
   284  	}).(PermissionOutput)
   285  }
   286  
   287  type PermissionMapOutput struct{ *pulumi.OutputState }
   288  
   289  func (PermissionMapOutput) ElementType() reflect.Type {
   290  	return reflect.TypeOf((*map[string]*Permission)(nil)).Elem()
   291  }
   292  
   293  func (o PermissionMapOutput) ToPermissionMapOutput() PermissionMapOutput {
   294  	return o
   295  }
   296  
   297  func (o PermissionMapOutput) ToPermissionMapOutputWithContext(ctx context.Context) PermissionMapOutput {
   298  	return o
   299  }
   300  
   301  func (o PermissionMapOutput) MapIndex(k pulumi.StringInput) PermissionOutput {
   302  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Permission {
   303  		return vs[0].(map[string]*Permission)[vs[1].(string)]
   304  	}).(PermissionOutput)
   305  }
   306  
   307  func init() {
   308  	pulumi.RegisterInputType(reflect.TypeOf((*PermissionInput)(nil)).Elem(), &Permission{})
   309  	pulumi.RegisterInputType(reflect.TypeOf((*PermissionArrayInput)(nil)).Elem(), PermissionArray{})
   310  	pulumi.RegisterInputType(reflect.TypeOf((*PermissionMapInput)(nil)).Elem(), PermissionMap{})
   311  	pulumi.RegisterOutputType(PermissionOutput{})
   312  	pulumi.RegisterOutputType(PermissionArrayOutput{})
   313  	pulumi.RegisterOutputType(PermissionMapOutput{})
   314  }