github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssoadmin/managedPolicyAttachment.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 ssoadmin
     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 IAM managed policy for a Single Sign-On (SSO) Permission Set resource
    16  //
    17  // > **NOTE:** Creating this resource will automatically [Provision the Permission Set](https://docs.aws.amazon.com/singlesignon/latest/APIReference/API_ProvisionPermissionSet.html) to apply the corresponding updates to all assigned accounts.
    18  //
    19  // ## Example Usage
    20  //
    21  // ## Import
    22  //
    23  // Using `pulumi import`, import SSO Managed Policy Attachments using the `managed_policy_arn`, `permission_set_arn`, and `instance_arn` separated by a comma (`,`). For example:
    24  //
    25  // ```sh
    26  // $ pulumi import aws:ssoadmin/managedPolicyAttachment:ManagedPolicyAttachment example arn:aws:iam::aws:policy/AlexaForBusinessDeviceSetup,arn:aws:sso:::permissionSet/ssoins-2938j0x8920sbj72/ps-80383020jr9302rk,arn:aws:sso:::instance/ssoins-2938j0x8920sbj72
    27  // ```
    28  type ManagedPolicyAttachment struct {
    29  	pulumi.CustomResourceState
    30  
    31  	// The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    32  	InstanceArn pulumi.StringOutput `pulumi:"instanceArn"`
    33  	// The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
    34  	ManagedPolicyArn pulumi.StringOutput `pulumi:"managedPolicyArn"`
    35  	// The name of the IAM Managed Policy.
    36  	ManagedPolicyName pulumi.StringOutput `pulumi:"managedPolicyName"`
    37  	// The Amazon Resource Name (ARN) of the Permission Set.
    38  	PermissionSetArn pulumi.StringOutput `pulumi:"permissionSetArn"`
    39  }
    40  
    41  // NewManagedPolicyAttachment registers a new resource with the given unique name, arguments, and options.
    42  func NewManagedPolicyAttachment(ctx *pulumi.Context,
    43  	name string, args *ManagedPolicyAttachmentArgs, opts ...pulumi.ResourceOption) (*ManagedPolicyAttachment, error) {
    44  	if args == nil {
    45  		return nil, errors.New("missing one or more required arguments")
    46  	}
    47  
    48  	if args.InstanceArn == nil {
    49  		return nil, errors.New("invalid value for required argument 'InstanceArn'")
    50  	}
    51  	if args.ManagedPolicyArn == nil {
    52  		return nil, errors.New("invalid value for required argument 'ManagedPolicyArn'")
    53  	}
    54  	if args.PermissionSetArn == nil {
    55  		return nil, errors.New("invalid value for required argument 'PermissionSetArn'")
    56  	}
    57  	opts = internal.PkgResourceDefaultOpts(opts)
    58  	var resource ManagedPolicyAttachment
    59  	err := ctx.RegisterResource("aws:ssoadmin/managedPolicyAttachment:ManagedPolicyAttachment", name, args, &resource, opts...)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	return &resource, nil
    64  }
    65  
    66  // GetManagedPolicyAttachment gets an existing ManagedPolicyAttachment resource's state with the given name, ID, and optional
    67  // state properties that are used to uniquely qualify the lookup (nil if not required).
    68  func GetManagedPolicyAttachment(ctx *pulumi.Context,
    69  	name string, id pulumi.IDInput, state *ManagedPolicyAttachmentState, opts ...pulumi.ResourceOption) (*ManagedPolicyAttachment, error) {
    70  	var resource ManagedPolicyAttachment
    71  	err := ctx.ReadResource("aws:ssoadmin/managedPolicyAttachment:ManagedPolicyAttachment", name, id, state, &resource, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return &resource, nil
    76  }
    77  
    78  // Input properties used for looking up and filtering ManagedPolicyAttachment resources.
    79  type managedPolicyAttachmentState struct {
    80  	// The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    81  	InstanceArn *string `pulumi:"instanceArn"`
    82  	// The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
    83  	ManagedPolicyArn *string `pulumi:"managedPolicyArn"`
    84  	// The name of the IAM Managed Policy.
    85  	ManagedPolicyName *string `pulumi:"managedPolicyName"`
    86  	// The Amazon Resource Name (ARN) of the Permission Set.
    87  	PermissionSetArn *string `pulumi:"permissionSetArn"`
    88  }
    89  
    90  type ManagedPolicyAttachmentState struct {
    91  	// The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
    92  	InstanceArn pulumi.StringPtrInput
    93  	// The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
    94  	ManagedPolicyArn pulumi.StringPtrInput
    95  	// The name of the IAM Managed Policy.
    96  	ManagedPolicyName pulumi.StringPtrInput
    97  	// The Amazon Resource Name (ARN) of the Permission Set.
    98  	PermissionSetArn pulumi.StringPtrInput
    99  }
   100  
   101  func (ManagedPolicyAttachmentState) ElementType() reflect.Type {
   102  	return reflect.TypeOf((*managedPolicyAttachmentState)(nil)).Elem()
   103  }
   104  
   105  type managedPolicyAttachmentArgs struct {
   106  	// The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
   107  	InstanceArn string `pulumi:"instanceArn"`
   108  	// The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
   109  	ManagedPolicyArn string `pulumi:"managedPolicyArn"`
   110  	// The Amazon Resource Name (ARN) of the Permission Set.
   111  	PermissionSetArn string `pulumi:"permissionSetArn"`
   112  }
   113  
   114  // The set of arguments for constructing a ManagedPolicyAttachment resource.
   115  type ManagedPolicyAttachmentArgs struct {
   116  	// The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
   117  	InstanceArn pulumi.StringInput
   118  	// The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
   119  	ManagedPolicyArn pulumi.StringInput
   120  	// The Amazon Resource Name (ARN) of the Permission Set.
   121  	PermissionSetArn pulumi.StringInput
   122  }
   123  
   124  func (ManagedPolicyAttachmentArgs) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*managedPolicyAttachmentArgs)(nil)).Elem()
   126  }
   127  
   128  type ManagedPolicyAttachmentInput interface {
   129  	pulumi.Input
   130  
   131  	ToManagedPolicyAttachmentOutput() ManagedPolicyAttachmentOutput
   132  	ToManagedPolicyAttachmentOutputWithContext(ctx context.Context) ManagedPolicyAttachmentOutput
   133  }
   134  
   135  func (*ManagedPolicyAttachment) ElementType() reflect.Type {
   136  	return reflect.TypeOf((**ManagedPolicyAttachment)(nil)).Elem()
   137  }
   138  
   139  func (i *ManagedPolicyAttachment) ToManagedPolicyAttachmentOutput() ManagedPolicyAttachmentOutput {
   140  	return i.ToManagedPolicyAttachmentOutputWithContext(context.Background())
   141  }
   142  
   143  func (i *ManagedPolicyAttachment) ToManagedPolicyAttachmentOutputWithContext(ctx context.Context) ManagedPolicyAttachmentOutput {
   144  	return pulumi.ToOutputWithContext(ctx, i).(ManagedPolicyAttachmentOutput)
   145  }
   146  
   147  // ManagedPolicyAttachmentArrayInput is an input type that accepts ManagedPolicyAttachmentArray and ManagedPolicyAttachmentArrayOutput values.
   148  // You can construct a concrete instance of `ManagedPolicyAttachmentArrayInput` via:
   149  //
   150  //	ManagedPolicyAttachmentArray{ ManagedPolicyAttachmentArgs{...} }
   151  type ManagedPolicyAttachmentArrayInput interface {
   152  	pulumi.Input
   153  
   154  	ToManagedPolicyAttachmentArrayOutput() ManagedPolicyAttachmentArrayOutput
   155  	ToManagedPolicyAttachmentArrayOutputWithContext(context.Context) ManagedPolicyAttachmentArrayOutput
   156  }
   157  
   158  type ManagedPolicyAttachmentArray []ManagedPolicyAttachmentInput
   159  
   160  func (ManagedPolicyAttachmentArray) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*[]*ManagedPolicyAttachment)(nil)).Elem()
   162  }
   163  
   164  func (i ManagedPolicyAttachmentArray) ToManagedPolicyAttachmentArrayOutput() ManagedPolicyAttachmentArrayOutput {
   165  	return i.ToManagedPolicyAttachmentArrayOutputWithContext(context.Background())
   166  }
   167  
   168  func (i ManagedPolicyAttachmentArray) ToManagedPolicyAttachmentArrayOutputWithContext(ctx context.Context) ManagedPolicyAttachmentArrayOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(ManagedPolicyAttachmentArrayOutput)
   170  }
   171  
   172  // ManagedPolicyAttachmentMapInput is an input type that accepts ManagedPolicyAttachmentMap and ManagedPolicyAttachmentMapOutput values.
   173  // You can construct a concrete instance of `ManagedPolicyAttachmentMapInput` via:
   174  //
   175  //	ManagedPolicyAttachmentMap{ "key": ManagedPolicyAttachmentArgs{...} }
   176  type ManagedPolicyAttachmentMapInput interface {
   177  	pulumi.Input
   178  
   179  	ToManagedPolicyAttachmentMapOutput() ManagedPolicyAttachmentMapOutput
   180  	ToManagedPolicyAttachmentMapOutputWithContext(context.Context) ManagedPolicyAttachmentMapOutput
   181  }
   182  
   183  type ManagedPolicyAttachmentMap map[string]ManagedPolicyAttachmentInput
   184  
   185  func (ManagedPolicyAttachmentMap) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*map[string]*ManagedPolicyAttachment)(nil)).Elem()
   187  }
   188  
   189  func (i ManagedPolicyAttachmentMap) ToManagedPolicyAttachmentMapOutput() ManagedPolicyAttachmentMapOutput {
   190  	return i.ToManagedPolicyAttachmentMapOutputWithContext(context.Background())
   191  }
   192  
   193  func (i ManagedPolicyAttachmentMap) ToManagedPolicyAttachmentMapOutputWithContext(ctx context.Context) ManagedPolicyAttachmentMapOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(ManagedPolicyAttachmentMapOutput)
   195  }
   196  
   197  type ManagedPolicyAttachmentOutput struct{ *pulumi.OutputState }
   198  
   199  func (ManagedPolicyAttachmentOutput) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**ManagedPolicyAttachment)(nil)).Elem()
   201  }
   202  
   203  func (o ManagedPolicyAttachmentOutput) ToManagedPolicyAttachmentOutput() ManagedPolicyAttachmentOutput {
   204  	return o
   205  }
   206  
   207  func (o ManagedPolicyAttachmentOutput) ToManagedPolicyAttachmentOutputWithContext(ctx context.Context) ManagedPolicyAttachmentOutput {
   208  	return o
   209  }
   210  
   211  // The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed.
   212  func (o ManagedPolicyAttachmentOutput) InstanceArn() pulumi.StringOutput {
   213  	return o.ApplyT(func(v *ManagedPolicyAttachment) pulumi.StringOutput { return v.InstanceArn }).(pulumi.StringOutput)
   214  }
   215  
   216  // The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set.
   217  func (o ManagedPolicyAttachmentOutput) ManagedPolicyArn() pulumi.StringOutput {
   218  	return o.ApplyT(func(v *ManagedPolicyAttachment) pulumi.StringOutput { return v.ManagedPolicyArn }).(pulumi.StringOutput)
   219  }
   220  
   221  // The name of the IAM Managed Policy.
   222  func (o ManagedPolicyAttachmentOutput) ManagedPolicyName() pulumi.StringOutput {
   223  	return o.ApplyT(func(v *ManagedPolicyAttachment) pulumi.StringOutput { return v.ManagedPolicyName }).(pulumi.StringOutput)
   224  }
   225  
   226  // The Amazon Resource Name (ARN) of the Permission Set.
   227  func (o ManagedPolicyAttachmentOutput) PermissionSetArn() pulumi.StringOutput {
   228  	return o.ApplyT(func(v *ManagedPolicyAttachment) pulumi.StringOutput { return v.PermissionSetArn }).(pulumi.StringOutput)
   229  }
   230  
   231  type ManagedPolicyAttachmentArrayOutput struct{ *pulumi.OutputState }
   232  
   233  func (ManagedPolicyAttachmentArrayOutput) ElementType() reflect.Type {
   234  	return reflect.TypeOf((*[]*ManagedPolicyAttachment)(nil)).Elem()
   235  }
   236  
   237  func (o ManagedPolicyAttachmentArrayOutput) ToManagedPolicyAttachmentArrayOutput() ManagedPolicyAttachmentArrayOutput {
   238  	return o
   239  }
   240  
   241  func (o ManagedPolicyAttachmentArrayOutput) ToManagedPolicyAttachmentArrayOutputWithContext(ctx context.Context) ManagedPolicyAttachmentArrayOutput {
   242  	return o
   243  }
   244  
   245  func (o ManagedPolicyAttachmentArrayOutput) Index(i pulumi.IntInput) ManagedPolicyAttachmentOutput {
   246  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ManagedPolicyAttachment {
   247  		return vs[0].([]*ManagedPolicyAttachment)[vs[1].(int)]
   248  	}).(ManagedPolicyAttachmentOutput)
   249  }
   250  
   251  type ManagedPolicyAttachmentMapOutput struct{ *pulumi.OutputState }
   252  
   253  func (ManagedPolicyAttachmentMapOutput) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*map[string]*ManagedPolicyAttachment)(nil)).Elem()
   255  }
   256  
   257  func (o ManagedPolicyAttachmentMapOutput) ToManagedPolicyAttachmentMapOutput() ManagedPolicyAttachmentMapOutput {
   258  	return o
   259  }
   260  
   261  func (o ManagedPolicyAttachmentMapOutput) ToManagedPolicyAttachmentMapOutputWithContext(ctx context.Context) ManagedPolicyAttachmentMapOutput {
   262  	return o
   263  }
   264  
   265  func (o ManagedPolicyAttachmentMapOutput) MapIndex(k pulumi.StringInput) ManagedPolicyAttachmentOutput {
   266  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ManagedPolicyAttachment {
   267  		return vs[0].(map[string]*ManagedPolicyAttachment)[vs[1].(string)]
   268  	}).(ManagedPolicyAttachmentOutput)
   269  }
   270  
   271  func init() {
   272  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedPolicyAttachmentInput)(nil)).Elem(), &ManagedPolicyAttachment{})
   273  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedPolicyAttachmentArrayInput)(nil)).Elem(), ManagedPolicyAttachmentArray{})
   274  	pulumi.RegisterInputType(reflect.TypeOf((*ManagedPolicyAttachmentMapInput)(nil)).Elem(), ManagedPolicyAttachmentMap{})
   275  	pulumi.RegisterOutputType(ManagedPolicyAttachmentOutput{})
   276  	pulumi.RegisterOutputType(ManagedPolicyAttachmentArrayOutput{})
   277  	pulumi.RegisterOutputType(ManagedPolicyAttachmentMapOutput{})
   278  }