github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/core/v1/secret.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  // Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.
    15  //
    16  // Note: While Pulumi automatically encrypts the 'data' and 'stringData'
    17  // fields, this encryption only applies to Pulumi's context, including the state file,
    18  // the Service, the CLI, etc. Kubernetes does not encrypt Secret resources by default,
    19  // and the contents are visible to users with access to the Secret in Kubernetes using
    20  // tools like 'kubectl'.
    21  //
    22  // For more information on securing Kubernetes Secrets, see the following links:
    23  // https://kubernetes.io/docs/concepts/configuration/secret/#security-properties
    24  // https://kubernetes.io/docs/concepts/configuration/secret/#risks
    25  type Secret struct {
    26  	pulumi.CustomResourceState
    27  
    28  	// 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
    29  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    30  	// Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4
    31  	Data pulumi.StringMapOutput `pulumi:"data"`
    32  	// Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.
    33  	Immutable pulumi.BoolPtrOutput `pulumi:"immutable"`
    34  	// 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
    35  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    36  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    37  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    38  	// stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.
    39  	StringData pulumi.StringMapOutput `pulumi:"stringData"`
    40  	// Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types
    41  	Type pulumi.StringPtrOutput `pulumi:"type"`
    42  }
    43  
    44  // NewSecret registers a new resource with the given unique name, arguments, and options.
    45  func NewSecret(ctx *pulumi.Context,
    46  	name string, args *SecretArgs, opts ...pulumi.ResourceOption) (*Secret, error) {
    47  	if args == nil {
    48  		args = &SecretArgs{}
    49  	}
    50  
    51  	args.ApiVersion = pulumi.StringPtr("v1")
    52  	args.Kind = pulumi.StringPtr("Secret")
    53  	if args.Data != nil {
    54  		args.Data = pulumi.ToSecret(args.Data).(pulumi.StringMapInput)
    55  	}
    56  	if args.StringData != nil {
    57  		args.StringData = pulumi.ToSecret(args.StringData).(pulumi.StringMapInput)
    58  	}
    59  	secrets := pulumi.AdditionalSecretOutputs([]string{
    60  		"data",
    61  		"stringData",
    62  	})
    63  	opts = append(opts, secrets)
    64  	var resource Secret
    65  	err := ctx.RegisterResource("kubernetes:core/v1:Secret", name, args, &resource, opts...)
    66  	if err != nil {
    67  		return nil, err
    68  	}
    69  	return &resource, nil
    70  }
    71  
    72  // GetSecret gets an existing Secret resource's state with the given name, ID, and optional
    73  // state properties that are used to uniquely qualify the lookup (nil if not required).
    74  func GetSecret(ctx *pulumi.Context,
    75  	name string, id pulumi.IDInput, state *SecretState, opts ...pulumi.ResourceOption) (*Secret, error) {
    76  	var resource Secret
    77  	err := ctx.ReadResource("kubernetes:core/v1:Secret", name, id, state, &resource, opts...)
    78  	if err != nil {
    79  		return nil, err
    80  	}
    81  	return &resource, nil
    82  }
    83  
    84  // Input properties used for looking up and filtering Secret resources.
    85  type secretState struct {
    86  }
    87  
    88  type SecretState struct {
    89  }
    90  
    91  func (SecretState) ElementType() reflect.Type {
    92  	return reflect.TypeOf((*secretState)(nil)).Elem()
    93  }
    94  
    95  type secretArgs struct {
    96  	// 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
    97  	ApiVersion *string `pulumi:"apiVersion"`
    98  	// Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4
    99  	Data map[string]string `pulumi:"data"`
   100  	// Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.
   101  	Immutable *bool `pulumi:"immutable"`
   102  	// 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
   103  	Kind *string `pulumi:"kind"`
   104  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   105  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
   106  	// stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.
   107  	StringData map[string]string `pulumi:"stringData"`
   108  	// Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types
   109  	Type *string `pulumi:"type"`
   110  }
   111  
   112  // The set of arguments for constructing a Secret resource.
   113  type SecretArgs struct {
   114  	// 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
   115  	ApiVersion pulumi.StringPtrInput
   116  	// Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4
   117  	Data pulumi.StringMapInput
   118  	// Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.
   119  	Immutable pulumi.BoolPtrInput
   120  	// 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
   121  	Kind pulumi.StringPtrInput
   122  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   123  	Metadata metav1.ObjectMetaPtrInput
   124  	// stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.
   125  	StringData pulumi.StringMapInput
   126  	// Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types
   127  	Type pulumi.StringPtrInput
   128  }
   129  
   130  func (SecretArgs) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*secretArgs)(nil)).Elem()
   132  }
   133  
   134  type SecretInput interface {
   135  	pulumi.Input
   136  
   137  	ToSecretOutput() SecretOutput
   138  	ToSecretOutputWithContext(ctx context.Context) SecretOutput
   139  }
   140  
   141  func (*Secret) ElementType() reflect.Type {
   142  	return reflect.TypeOf((**Secret)(nil)).Elem()
   143  }
   144  
   145  func (i *Secret) ToSecretOutput() SecretOutput {
   146  	return i.ToSecretOutputWithContext(context.Background())
   147  }
   148  
   149  func (i *Secret) ToSecretOutputWithContext(ctx context.Context) SecretOutput {
   150  	return pulumi.ToOutputWithContext(ctx, i).(SecretOutput)
   151  }
   152  
   153  // SecretArrayInput is an input type that accepts SecretArray and SecretArrayOutput values.
   154  // You can construct a concrete instance of `SecretArrayInput` via:
   155  //
   156  //	SecretArray{ SecretArgs{...} }
   157  type SecretArrayInput interface {
   158  	pulumi.Input
   159  
   160  	ToSecretArrayOutput() SecretArrayOutput
   161  	ToSecretArrayOutputWithContext(context.Context) SecretArrayOutput
   162  }
   163  
   164  type SecretArray []SecretInput
   165  
   166  func (SecretArray) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*[]*Secret)(nil)).Elem()
   168  }
   169  
   170  func (i SecretArray) ToSecretArrayOutput() SecretArrayOutput {
   171  	return i.ToSecretArrayOutputWithContext(context.Background())
   172  }
   173  
   174  func (i SecretArray) ToSecretArrayOutputWithContext(ctx context.Context) SecretArrayOutput {
   175  	return pulumi.ToOutputWithContext(ctx, i).(SecretArrayOutput)
   176  }
   177  
   178  // SecretMapInput is an input type that accepts SecretMap and SecretMapOutput values.
   179  // You can construct a concrete instance of `SecretMapInput` via:
   180  //
   181  //	SecretMap{ "key": SecretArgs{...} }
   182  type SecretMapInput interface {
   183  	pulumi.Input
   184  
   185  	ToSecretMapOutput() SecretMapOutput
   186  	ToSecretMapOutputWithContext(context.Context) SecretMapOutput
   187  }
   188  
   189  type SecretMap map[string]SecretInput
   190  
   191  func (SecretMap) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*map[string]*Secret)(nil)).Elem()
   193  }
   194  
   195  func (i SecretMap) ToSecretMapOutput() SecretMapOutput {
   196  	return i.ToSecretMapOutputWithContext(context.Background())
   197  }
   198  
   199  func (i SecretMap) ToSecretMapOutputWithContext(ctx context.Context) SecretMapOutput {
   200  	return pulumi.ToOutputWithContext(ctx, i).(SecretMapOutput)
   201  }
   202  
   203  type SecretOutput struct{ *pulumi.OutputState }
   204  
   205  func (SecretOutput) ElementType() reflect.Type {
   206  	return reflect.TypeOf((**Secret)(nil)).Elem()
   207  }
   208  
   209  func (o SecretOutput) ToSecretOutput() SecretOutput {
   210  	return o
   211  }
   212  
   213  func (o SecretOutput) ToSecretOutputWithContext(ctx context.Context) SecretOutput {
   214  	return o
   215  }
   216  
   217  // 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
   218  func (o SecretOutput) ApiVersion() pulumi.StringPtrOutput {
   219  	return o.ApplyT(func(v *Secret) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   220  }
   221  
   222  // Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4
   223  func (o SecretOutput) Data() pulumi.StringMapOutput {
   224  	return o.ApplyT(func(v *Secret) pulumi.StringMapOutput { return v.Data }).(pulumi.StringMapOutput)
   225  }
   226  
   227  // Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.
   228  func (o SecretOutput) Immutable() pulumi.BoolPtrOutput {
   229  	return o.ApplyT(func(v *Secret) pulumi.BoolPtrOutput { return v.Immutable }).(pulumi.BoolPtrOutput)
   230  }
   231  
   232  // 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
   233  func (o SecretOutput) Kind() pulumi.StringPtrOutput {
   234  	return o.ApplyT(func(v *Secret) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   235  }
   236  
   237  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   238  func (o SecretOutput) Metadata() metav1.ObjectMetaPtrOutput {
   239  	return o.ApplyT(func(v *Secret) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   240  }
   241  
   242  // stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.
   243  func (o SecretOutput) StringData() pulumi.StringMapOutput {
   244  	return o.ApplyT(func(v *Secret) pulumi.StringMapOutput { return v.StringData }).(pulumi.StringMapOutput)
   245  }
   246  
   247  // Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types
   248  func (o SecretOutput) Type() pulumi.StringPtrOutput {
   249  	return o.ApplyT(func(v *Secret) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput)
   250  }
   251  
   252  type SecretArrayOutput struct{ *pulumi.OutputState }
   253  
   254  func (SecretArrayOutput) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*[]*Secret)(nil)).Elem()
   256  }
   257  
   258  func (o SecretArrayOutput) ToSecretArrayOutput() SecretArrayOutput {
   259  	return o
   260  }
   261  
   262  func (o SecretArrayOutput) ToSecretArrayOutputWithContext(ctx context.Context) SecretArrayOutput {
   263  	return o
   264  }
   265  
   266  func (o SecretArrayOutput) Index(i pulumi.IntInput) SecretOutput {
   267  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Secret {
   268  		return vs[0].([]*Secret)[vs[1].(int)]
   269  	}).(SecretOutput)
   270  }
   271  
   272  type SecretMapOutput struct{ *pulumi.OutputState }
   273  
   274  func (SecretMapOutput) ElementType() reflect.Type {
   275  	return reflect.TypeOf((*map[string]*Secret)(nil)).Elem()
   276  }
   277  
   278  func (o SecretMapOutput) ToSecretMapOutput() SecretMapOutput {
   279  	return o
   280  }
   281  
   282  func (o SecretMapOutput) ToSecretMapOutputWithContext(ctx context.Context) SecretMapOutput {
   283  	return o
   284  }
   285  
   286  func (o SecretMapOutput) MapIndex(k pulumi.StringInput) SecretOutput {
   287  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Secret {
   288  		return vs[0].(map[string]*Secret)[vs[1].(string)]
   289  	}).(SecretOutput)
   290  }
   291  
   292  func init() {
   293  	pulumi.RegisterInputType(reflect.TypeOf((*SecretInput)(nil)).Elem(), &Secret{})
   294  	pulumi.RegisterInputType(reflect.TypeOf((*SecretArrayInput)(nil)).Elem(), SecretArray{})
   295  	pulumi.RegisterInputType(reflect.TypeOf((*SecretMapInput)(nil)).Elem(), SecretMap{})
   296  	pulumi.RegisterOutputType(SecretOutput{})
   297  	pulumi.RegisterOutputType(SecretArrayOutput{})
   298  	pulumi.RegisterOutputType(SecretMapOutput{})
   299  }