github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/eks/accessPolicyAssociation.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 eks
     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  // Access Entry Policy Association for an EKS Cluster.
    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/eks"
    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 := eks.NewAccessPolicyAssociation(ctx, "example", &eks.AccessPolicyAssociationArgs{
    33  //				ClusterName:  pulumi.Any(exampleAwsEksCluster.Name),
    34  //				PolicyArn:    pulumi.String("arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy"),
    35  //				PrincipalArn: pulumi.Any(exampleAwsIamUser.Arn),
    36  //				AccessScope: &eks.AccessPolicyAssociationAccessScopeArgs{
    37  //					Type: pulumi.String("namespace"),
    38  //					Namespaces: pulumi.StringArray{
    39  //						pulumi.String("example-namespace"),
    40  //					},
    41  //				},
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Import
    54  //
    55  // Using `pulumi import`, import EKS access entry using the `cluster_name` `principal_arn` and `policy_arn` separated by a colon (`#`). For example:
    56  //
    57  // ```sh
    58  // $ pulumi import aws:eks/accessPolicyAssociation:AccessPolicyAssociation my_eks_access_entry my_cluster_name#my_principal_arn#my_policy_arn
    59  // ```
    60  type AccessPolicyAssociation struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// The configuration block to determine the scope of the access. See `accessScope` Block below.
    64  	AccessScope AccessPolicyAssociationAccessScopeOutput `pulumi:"accessScope"`
    65  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was associated.
    66  	AssociatedAt pulumi.StringOutput `pulumi:"associatedAt"`
    67  	// Name of the EKS Cluster.
    68  	ClusterName pulumi.StringOutput `pulumi:"clusterName"`
    69  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was updated.
    70  	ModifiedAt pulumi.StringOutput `pulumi:"modifiedAt"`
    71  	// The ARN of the access policy that you're associating.
    72  	PolicyArn pulumi.StringOutput `pulumi:"policyArn"`
    73  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
    74  	PrincipalArn pulumi.StringOutput `pulumi:"principalArn"`
    75  }
    76  
    77  // NewAccessPolicyAssociation registers a new resource with the given unique name, arguments, and options.
    78  func NewAccessPolicyAssociation(ctx *pulumi.Context,
    79  	name string, args *AccessPolicyAssociationArgs, opts ...pulumi.ResourceOption) (*AccessPolicyAssociation, error) {
    80  	if args == nil {
    81  		return nil, errors.New("missing one or more required arguments")
    82  	}
    83  
    84  	if args.AccessScope == nil {
    85  		return nil, errors.New("invalid value for required argument 'AccessScope'")
    86  	}
    87  	if args.ClusterName == nil {
    88  		return nil, errors.New("invalid value for required argument 'ClusterName'")
    89  	}
    90  	if args.PolicyArn == nil {
    91  		return nil, errors.New("invalid value for required argument 'PolicyArn'")
    92  	}
    93  	if args.PrincipalArn == nil {
    94  		return nil, errors.New("invalid value for required argument 'PrincipalArn'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource AccessPolicyAssociation
    98  	err := ctx.RegisterResource("aws:eks/accessPolicyAssociation:AccessPolicyAssociation", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetAccessPolicyAssociation gets an existing AccessPolicyAssociation resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetAccessPolicyAssociation(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *AccessPolicyAssociationState, opts ...pulumi.ResourceOption) (*AccessPolicyAssociation, error) {
   109  	var resource AccessPolicyAssociation
   110  	err := ctx.ReadResource("aws:eks/accessPolicyAssociation:AccessPolicyAssociation", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering AccessPolicyAssociation resources.
   118  type accessPolicyAssociationState struct {
   119  	// The configuration block to determine the scope of the access. See `accessScope` Block below.
   120  	AccessScope *AccessPolicyAssociationAccessScope `pulumi:"accessScope"`
   121  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was associated.
   122  	AssociatedAt *string `pulumi:"associatedAt"`
   123  	// Name of the EKS Cluster.
   124  	ClusterName *string `pulumi:"clusterName"`
   125  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was updated.
   126  	ModifiedAt *string `pulumi:"modifiedAt"`
   127  	// The ARN of the access policy that you're associating.
   128  	PolicyArn *string `pulumi:"policyArn"`
   129  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   130  	PrincipalArn *string `pulumi:"principalArn"`
   131  }
   132  
   133  type AccessPolicyAssociationState struct {
   134  	// The configuration block to determine the scope of the access. See `accessScope` Block below.
   135  	AccessScope AccessPolicyAssociationAccessScopePtrInput
   136  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was associated.
   137  	AssociatedAt pulumi.StringPtrInput
   138  	// Name of the EKS Cluster.
   139  	ClusterName pulumi.StringPtrInput
   140  	// Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was updated.
   141  	ModifiedAt pulumi.StringPtrInput
   142  	// The ARN of the access policy that you're associating.
   143  	PolicyArn pulumi.StringPtrInput
   144  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   145  	PrincipalArn pulumi.StringPtrInput
   146  }
   147  
   148  func (AccessPolicyAssociationState) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*accessPolicyAssociationState)(nil)).Elem()
   150  }
   151  
   152  type accessPolicyAssociationArgs struct {
   153  	// The configuration block to determine the scope of the access. See `accessScope` Block below.
   154  	AccessScope AccessPolicyAssociationAccessScope `pulumi:"accessScope"`
   155  	// Name of the EKS Cluster.
   156  	ClusterName string `pulumi:"clusterName"`
   157  	// The ARN of the access policy that you're associating.
   158  	PolicyArn string `pulumi:"policyArn"`
   159  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   160  	PrincipalArn string `pulumi:"principalArn"`
   161  }
   162  
   163  // The set of arguments for constructing a AccessPolicyAssociation resource.
   164  type AccessPolicyAssociationArgs struct {
   165  	// The configuration block to determine the scope of the access. See `accessScope` Block below.
   166  	AccessScope AccessPolicyAssociationAccessScopeInput
   167  	// Name of the EKS Cluster.
   168  	ClusterName pulumi.StringInput
   169  	// The ARN of the access policy that you're associating.
   170  	PolicyArn pulumi.StringInput
   171  	// The IAM Principal ARN which requires Authentication access to the EKS cluster.
   172  	PrincipalArn pulumi.StringInput
   173  }
   174  
   175  func (AccessPolicyAssociationArgs) ElementType() reflect.Type {
   176  	return reflect.TypeOf((*accessPolicyAssociationArgs)(nil)).Elem()
   177  }
   178  
   179  type AccessPolicyAssociationInput interface {
   180  	pulumi.Input
   181  
   182  	ToAccessPolicyAssociationOutput() AccessPolicyAssociationOutput
   183  	ToAccessPolicyAssociationOutputWithContext(ctx context.Context) AccessPolicyAssociationOutput
   184  }
   185  
   186  func (*AccessPolicyAssociation) ElementType() reflect.Type {
   187  	return reflect.TypeOf((**AccessPolicyAssociation)(nil)).Elem()
   188  }
   189  
   190  func (i *AccessPolicyAssociation) ToAccessPolicyAssociationOutput() AccessPolicyAssociationOutput {
   191  	return i.ToAccessPolicyAssociationOutputWithContext(context.Background())
   192  }
   193  
   194  func (i *AccessPolicyAssociation) ToAccessPolicyAssociationOutputWithContext(ctx context.Context) AccessPolicyAssociationOutput {
   195  	return pulumi.ToOutputWithContext(ctx, i).(AccessPolicyAssociationOutput)
   196  }
   197  
   198  // AccessPolicyAssociationArrayInput is an input type that accepts AccessPolicyAssociationArray and AccessPolicyAssociationArrayOutput values.
   199  // You can construct a concrete instance of `AccessPolicyAssociationArrayInput` via:
   200  //
   201  //	AccessPolicyAssociationArray{ AccessPolicyAssociationArgs{...} }
   202  type AccessPolicyAssociationArrayInput interface {
   203  	pulumi.Input
   204  
   205  	ToAccessPolicyAssociationArrayOutput() AccessPolicyAssociationArrayOutput
   206  	ToAccessPolicyAssociationArrayOutputWithContext(context.Context) AccessPolicyAssociationArrayOutput
   207  }
   208  
   209  type AccessPolicyAssociationArray []AccessPolicyAssociationInput
   210  
   211  func (AccessPolicyAssociationArray) ElementType() reflect.Type {
   212  	return reflect.TypeOf((*[]*AccessPolicyAssociation)(nil)).Elem()
   213  }
   214  
   215  func (i AccessPolicyAssociationArray) ToAccessPolicyAssociationArrayOutput() AccessPolicyAssociationArrayOutput {
   216  	return i.ToAccessPolicyAssociationArrayOutputWithContext(context.Background())
   217  }
   218  
   219  func (i AccessPolicyAssociationArray) ToAccessPolicyAssociationArrayOutputWithContext(ctx context.Context) AccessPolicyAssociationArrayOutput {
   220  	return pulumi.ToOutputWithContext(ctx, i).(AccessPolicyAssociationArrayOutput)
   221  }
   222  
   223  // AccessPolicyAssociationMapInput is an input type that accepts AccessPolicyAssociationMap and AccessPolicyAssociationMapOutput values.
   224  // You can construct a concrete instance of `AccessPolicyAssociationMapInput` via:
   225  //
   226  //	AccessPolicyAssociationMap{ "key": AccessPolicyAssociationArgs{...} }
   227  type AccessPolicyAssociationMapInput interface {
   228  	pulumi.Input
   229  
   230  	ToAccessPolicyAssociationMapOutput() AccessPolicyAssociationMapOutput
   231  	ToAccessPolicyAssociationMapOutputWithContext(context.Context) AccessPolicyAssociationMapOutput
   232  }
   233  
   234  type AccessPolicyAssociationMap map[string]AccessPolicyAssociationInput
   235  
   236  func (AccessPolicyAssociationMap) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*map[string]*AccessPolicyAssociation)(nil)).Elem()
   238  }
   239  
   240  func (i AccessPolicyAssociationMap) ToAccessPolicyAssociationMapOutput() AccessPolicyAssociationMapOutput {
   241  	return i.ToAccessPolicyAssociationMapOutputWithContext(context.Background())
   242  }
   243  
   244  func (i AccessPolicyAssociationMap) ToAccessPolicyAssociationMapOutputWithContext(ctx context.Context) AccessPolicyAssociationMapOutput {
   245  	return pulumi.ToOutputWithContext(ctx, i).(AccessPolicyAssociationMapOutput)
   246  }
   247  
   248  type AccessPolicyAssociationOutput struct{ *pulumi.OutputState }
   249  
   250  func (AccessPolicyAssociationOutput) ElementType() reflect.Type {
   251  	return reflect.TypeOf((**AccessPolicyAssociation)(nil)).Elem()
   252  }
   253  
   254  func (o AccessPolicyAssociationOutput) ToAccessPolicyAssociationOutput() AccessPolicyAssociationOutput {
   255  	return o
   256  }
   257  
   258  func (o AccessPolicyAssociationOutput) ToAccessPolicyAssociationOutputWithContext(ctx context.Context) AccessPolicyAssociationOutput {
   259  	return o
   260  }
   261  
   262  // The configuration block to determine the scope of the access. See `accessScope` Block below.
   263  func (o AccessPolicyAssociationOutput) AccessScope() AccessPolicyAssociationAccessScopeOutput {
   264  	return o.ApplyT(func(v *AccessPolicyAssociation) AccessPolicyAssociationAccessScopeOutput { return v.AccessScope }).(AccessPolicyAssociationAccessScopeOutput)
   265  }
   266  
   267  // Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was associated.
   268  func (o AccessPolicyAssociationOutput) AssociatedAt() pulumi.StringOutput {
   269  	return o.ApplyT(func(v *AccessPolicyAssociation) pulumi.StringOutput { return v.AssociatedAt }).(pulumi.StringOutput)
   270  }
   271  
   272  // Name of the EKS Cluster.
   273  func (o AccessPolicyAssociationOutput) ClusterName() pulumi.StringOutput {
   274  	return o.ApplyT(func(v *AccessPolicyAssociation) pulumi.StringOutput { return v.ClusterName }).(pulumi.StringOutput)
   275  }
   276  
   277  // Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) that the policy was updated.
   278  func (o AccessPolicyAssociationOutput) ModifiedAt() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *AccessPolicyAssociation) pulumi.StringOutput { return v.ModifiedAt }).(pulumi.StringOutput)
   280  }
   281  
   282  // The ARN of the access policy that you're associating.
   283  func (o AccessPolicyAssociationOutput) PolicyArn() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *AccessPolicyAssociation) pulumi.StringOutput { return v.PolicyArn }).(pulumi.StringOutput)
   285  }
   286  
   287  // The IAM Principal ARN which requires Authentication access to the EKS cluster.
   288  func (o AccessPolicyAssociationOutput) PrincipalArn() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *AccessPolicyAssociation) pulumi.StringOutput { return v.PrincipalArn }).(pulumi.StringOutput)
   290  }
   291  
   292  type AccessPolicyAssociationArrayOutput struct{ *pulumi.OutputState }
   293  
   294  func (AccessPolicyAssociationArrayOutput) ElementType() reflect.Type {
   295  	return reflect.TypeOf((*[]*AccessPolicyAssociation)(nil)).Elem()
   296  }
   297  
   298  func (o AccessPolicyAssociationArrayOutput) ToAccessPolicyAssociationArrayOutput() AccessPolicyAssociationArrayOutput {
   299  	return o
   300  }
   301  
   302  func (o AccessPolicyAssociationArrayOutput) ToAccessPolicyAssociationArrayOutputWithContext(ctx context.Context) AccessPolicyAssociationArrayOutput {
   303  	return o
   304  }
   305  
   306  func (o AccessPolicyAssociationArrayOutput) Index(i pulumi.IntInput) AccessPolicyAssociationOutput {
   307  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccessPolicyAssociation {
   308  		return vs[0].([]*AccessPolicyAssociation)[vs[1].(int)]
   309  	}).(AccessPolicyAssociationOutput)
   310  }
   311  
   312  type AccessPolicyAssociationMapOutput struct{ *pulumi.OutputState }
   313  
   314  func (AccessPolicyAssociationMapOutput) ElementType() reflect.Type {
   315  	return reflect.TypeOf((*map[string]*AccessPolicyAssociation)(nil)).Elem()
   316  }
   317  
   318  func (o AccessPolicyAssociationMapOutput) ToAccessPolicyAssociationMapOutput() AccessPolicyAssociationMapOutput {
   319  	return o
   320  }
   321  
   322  func (o AccessPolicyAssociationMapOutput) ToAccessPolicyAssociationMapOutputWithContext(ctx context.Context) AccessPolicyAssociationMapOutput {
   323  	return o
   324  }
   325  
   326  func (o AccessPolicyAssociationMapOutput) MapIndex(k pulumi.StringInput) AccessPolicyAssociationOutput {
   327  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccessPolicyAssociation {
   328  		return vs[0].(map[string]*AccessPolicyAssociation)[vs[1].(string)]
   329  	}).(AccessPolicyAssociationOutput)
   330  }
   331  
   332  func init() {
   333  	pulumi.RegisterInputType(reflect.TypeOf((*AccessPolicyAssociationInput)(nil)).Elem(), &AccessPolicyAssociation{})
   334  	pulumi.RegisterInputType(reflect.TypeOf((*AccessPolicyAssociationArrayInput)(nil)).Elem(), AccessPolicyAssociationArray{})
   335  	pulumi.RegisterInputType(reflect.TypeOf((*AccessPolicyAssociationMapInput)(nil)).Elem(), AccessPolicyAssociationMap{})
   336  	pulumi.RegisterOutputType(AccessPolicyAssociationOutput{})
   337  	pulumi.RegisterOutputType(AccessPolicyAssociationArrayOutput{})
   338  	pulumi.RegisterOutputType(AccessPolicyAssociationMapOutput{})
   339  }