github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/core/v1/serviceAccount.go (about)

     1  // Code generated by pulumigen DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package v1
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets
    15  type ServiceAccount struct {
    16  	pulumi.CustomResourceState
    17  
    18  	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
    19  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    20  	// AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.
    21  	AutomountServiceAccountToken pulumi.BoolPtrOutput `pulumi:"automountServiceAccountToken"`
    22  	// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
    23  	ImagePullSecrets LocalObjectReferenceArrayOutput `pulumi:"imagePullSecrets"`
    24  	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    25  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    26  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    27  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    28  	// Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret
    29  	Secrets ObjectReferenceArrayOutput `pulumi:"secrets"`
    30  }
    31  
    32  // NewServiceAccount registers a new resource with the given unique name, arguments, and options.
    33  func NewServiceAccount(ctx *pulumi.Context,
    34  	name string, args *ServiceAccountArgs, opts ...pulumi.ResourceOption) (*ServiceAccount, error) {
    35  	if args == nil {
    36  		args = &ServiceAccountArgs{}
    37  	}
    38  
    39  	args.ApiVersion = pulumi.StringPtr("v1")
    40  	args.Kind = pulumi.StringPtr("ServiceAccount")
    41  	var resource ServiceAccount
    42  	err := ctx.RegisterResource("kubernetes:core/v1:ServiceAccount", name, args, &resource, opts...)
    43  	if err != nil {
    44  		return nil, err
    45  	}
    46  	return &resource, nil
    47  }
    48  
    49  // GetServiceAccount gets an existing ServiceAccount resource's state with the given name, ID, and optional
    50  // state properties that are used to uniquely qualify the lookup (nil if not required).
    51  func GetServiceAccount(ctx *pulumi.Context,
    52  	name string, id pulumi.IDInput, state *ServiceAccountState, opts ...pulumi.ResourceOption) (*ServiceAccount, error) {
    53  	var resource ServiceAccount
    54  	err := ctx.ReadResource("kubernetes:core/v1:ServiceAccount", name, id, state, &resource, opts...)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  	return &resource, nil
    59  }
    60  
    61  // Input properties used for looking up and filtering ServiceAccount resources.
    62  type serviceAccountState struct {
    63  }
    64  
    65  type ServiceAccountState struct {
    66  }
    67  
    68  func (ServiceAccountState) ElementType() reflect.Type {
    69  	return reflect.TypeOf((*serviceAccountState)(nil)).Elem()
    70  }
    71  
    72  type serviceAccountArgs struct {
    73  	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
    74  	ApiVersion *string `pulumi:"apiVersion"`
    75  	// AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.
    76  	AutomountServiceAccountToken *bool `pulumi:"automountServiceAccountToken"`
    77  	// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
    78  	ImagePullSecrets []LocalObjectReference `pulumi:"imagePullSecrets"`
    79  	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    80  	Kind *string `pulumi:"kind"`
    81  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    82  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
    83  	// Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret
    84  	Secrets []ObjectReference `pulumi:"secrets"`
    85  }
    86  
    87  // The set of arguments for constructing a ServiceAccount resource.
    88  type ServiceAccountArgs struct {
    89  	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
    90  	ApiVersion pulumi.StringPtrInput
    91  	// AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.
    92  	AutomountServiceAccountToken pulumi.BoolPtrInput
    93  	// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
    94  	ImagePullSecrets LocalObjectReferenceArrayInput
    95  	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    96  	Kind pulumi.StringPtrInput
    97  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    98  	Metadata metav1.ObjectMetaPtrInput
    99  	// Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret
   100  	Secrets ObjectReferenceArrayInput
   101  }
   102  
   103  func (ServiceAccountArgs) ElementType() reflect.Type {
   104  	return reflect.TypeOf((*serviceAccountArgs)(nil)).Elem()
   105  }
   106  
   107  type ServiceAccountInput interface {
   108  	pulumi.Input
   109  
   110  	ToServiceAccountOutput() ServiceAccountOutput
   111  	ToServiceAccountOutputWithContext(ctx context.Context) ServiceAccountOutput
   112  }
   113  
   114  func (*ServiceAccount) ElementType() reflect.Type {
   115  	return reflect.TypeOf((**ServiceAccount)(nil)).Elem()
   116  }
   117  
   118  func (i *ServiceAccount) ToServiceAccountOutput() ServiceAccountOutput {
   119  	return i.ToServiceAccountOutputWithContext(context.Background())
   120  }
   121  
   122  func (i *ServiceAccount) ToServiceAccountOutputWithContext(ctx context.Context) ServiceAccountOutput {
   123  	return pulumi.ToOutputWithContext(ctx, i).(ServiceAccountOutput)
   124  }
   125  
   126  // ServiceAccountArrayInput is an input type that accepts ServiceAccountArray and ServiceAccountArrayOutput values.
   127  // You can construct a concrete instance of `ServiceAccountArrayInput` via:
   128  //
   129  //	ServiceAccountArray{ ServiceAccountArgs{...} }
   130  type ServiceAccountArrayInput interface {
   131  	pulumi.Input
   132  
   133  	ToServiceAccountArrayOutput() ServiceAccountArrayOutput
   134  	ToServiceAccountArrayOutputWithContext(context.Context) ServiceAccountArrayOutput
   135  }
   136  
   137  type ServiceAccountArray []ServiceAccountInput
   138  
   139  func (ServiceAccountArray) ElementType() reflect.Type {
   140  	return reflect.TypeOf((*[]*ServiceAccount)(nil)).Elem()
   141  }
   142  
   143  func (i ServiceAccountArray) ToServiceAccountArrayOutput() ServiceAccountArrayOutput {
   144  	return i.ToServiceAccountArrayOutputWithContext(context.Background())
   145  }
   146  
   147  func (i ServiceAccountArray) ToServiceAccountArrayOutputWithContext(ctx context.Context) ServiceAccountArrayOutput {
   148  	return pulumi.ToOutputWithContext(ctx, i).(ServiceAccountArrayOutput)
   149  }
   150  
   151  // ServiceAccountMapInput is an input type that accepts ServiceAccountMap and ServiceAccountMapOutput values.
   152  // You can construct a concrete instance of `ServiceAccountMapInput` via:
   153  //
   154  //	ServiceAccountMap{ "key": ServiceAccountArgs{...} }
   155  type ServiceAccountMapInput interface {
   156  	pulumi.Input
   157  
   158  	ToServiceAccountMapOutput() ServiceAccountMapOutput
   159  	ToServiceAccountMapOutputWithContext(context.Context) ServiceAccountMapOutput
   160  }
   161  
   162  type ServiceAccountMap map[string]ServiceAccountInput
   163  
   164  func (ServiceAccountMap) ElementType() reflect.Type {
   165  	return reflect.TypeOf((*map[string]*ServiceAccount)(nil)).Elem()
   166  }
   167  
   168  func (i ServiceAccountMap) ToServiceAccountMapOutput() ServiceAccountMapOutput {
   169  	return i.ToServiceAccountMapOutputWithContext(context.Background())
   170  }
   171  
   172  func (i ServiceAccountMap) ToServiceAccountMapOutputWithContext(ctx context.Context) ServiceAccountMapOutput {
   173  	return pulumi.ToOutputWithContext(ctx, i).(ServiceAccountMapOutput)
   174  }
   175  
   176  type ServiceAccountOutput struct{ *pulumi.OutputState }
   177  
   178  func (ServiceAccountOutput) ElementType() reflect.Type {
   179  	return reflect.TypeOf((**ServiceAccount)(nil)).Elem()
   180  }
   181  
   182  func (o ServiceAccountOutput) ToServiceAccountOutput() ServiceAccountOutput {
   183  	return o
   184  }
   185  
   186  func (o ServiceAccountOutput) ToServiceAccountOutputWithContext(ctx context.Context) ServiceAccountOutput {
   187  	return o
   188  }
   189  
   190  // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
   191  func (o ServiceAccountOutput) ApiVersion() pulumi.StringPtrOutput {
   192  	return o.ApplyT(func(v *ServiceAccount) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   193  }
   194  
   195  // AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.
   196  func (o ServiceAccountOutput) AutomountServiceAccountToken() pulumi.BoolPtrOutput {
   197  	return o.ApplyT(func(v *ServiceAccount) pulumi.BoolPtrOutput { return v.AutomountServiceAccountToken }).(pulumi.BoolPtrOutput)
   198  }
   199  
   200  // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
   201  func (o ServiceAccountOutput) ImagePullSecrets() LocalObjectReferenceArrayOutput {
   202  	return o.ApplyT(func(v *ServiceAccount) LocalObjectReferenceArrayOutput { return v.ImagePullSecrets }).(LocalObjectReferenceArrayOutput)
   203  }
   204  
   205  // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   206  func (o ServiceAccountOutput) Kind() pulumi.StringPtrOutput {
   207  	return o.ApplyT(func(v *ServiceAccount) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   208  }
   209  
   210  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   211  func (o ServiceAccountOutput) Metadata() metav1.ObjectMetaPtrOutput {
   212  	return o.ApplyT(func(v *ServiceAccount) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   213  }
   214  
   215  // Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret
   216  func (o ServiceAccountOutput) Secrets() ObjectReferenceArrayOutput {
   217  	return o.ApplyT(func(v *ServiceAccount) ObjectReferenceArrayOutput { return v.Secrets }).(ObjectReferenceArrayOutput)
   218  }
   219  
   220  type ServiceAccountArrayOutput struct{ *pulumi.OutputState }
   221  
   222  func (ServiceAccountArrayOutput) ElementType() reflect.Type {
   223  	return reflect.TypeOf((*[]*ServiceAccount)(nil)).Elem()
   224  }
   225  
   226  func (o ServiceAccountArrayOutput) ToServiceAccountArrayOutput() ServiceAccountArrayOutput {
   227  	return o
   228  }
   229  
   230  func (o ServiceAccountArrayOutput) ToServiceAccountArrayOutputWithContext(ctx context.Context) ServiceAccountArrayOutput {
   231  	return o
   232  }
   233  
   234  func (o ServiceAccountArrayOutput) Index(i pulumi.IntInput) ServiceAccountOutput {
   235  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceAccount {
   236  		return vs[0].([]*ServiceAccount)[vs[1].(int)]
   237  	}).(ServiceAccountOutput)
   238  }
   239  
   240  type ServiceAccountMapOutput struct{ *pulumi.OutputState }
   241  
   242  func (ServiceAccountMapOutput) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*map[string]*ServiceAccount)(nil)).Elem()
   244  }
   245  
   246  func (o ServiceAccountMapOutput) ToServiceAccountMapOutput() ServiceAccountMapOutput {
   247  	return o
   248  }
   249  
   250  func (o ServiceAccountMapOutput) ToServiceAccountMapOutputWithContext(ctx context.Context) ServiceAccountMapOutput {
   251  	return o
   252  }
   253  
   254  func (o ServiceAccountMapOutput) MapIndex(k pulumi.StringInput) ServiceAccountOutput {
   255  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceAccount {
   256  		return vs[0].(map[string]*ServiceAccount)[vs[1].(string)]
   257  	}).(ServiceAccountOutput)
   258  }
   259  
   260  func init() {
   261  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceAccountInput)(nil)).Elem(), &ServiceAccount{})
   262  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceAccountArrayInput)(nil)).Elem(), ServiceAccountArray{})
   263  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceAccountMapInput)(nil)).Elem(), ServiceAccountMap{})
   264  	pulumi.RegisterOutputType(ServiceAccountOutput{})
   265  	pulumi.RegisterOutputType(ServiceAccountArrayOutput{})
   266  	pulumi.RegisterOutputType(ServiceAccountMapOutput{})
   267  }