github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/core/v1/namespace.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  // Namespace provides a scope for Names. Use of multiple namespaces is optional.
    15  type Namespace 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  	// 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
    21  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    22  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    23  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    24  	// Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    25  	Spec NamespaceSpecPtrOutput `pulumi:"spec"`
    26  	// Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    27  	Status NamespaceStatusPtrOutput `pulumi:"status"`
    28  }
    29  
    30  // NewNamespace registers a new resource with the given unique name, arguments, and options.
    31  func NewNamespace(ctx *pulumi.Context,
    32  	name string, args *NamespaceArgs, opts ...pulumi.ResourceOption) (*Namespace, error) {
    33  	if args == nil {
    34  		args = &NamespaceArgs{}
    35  	}
    36  
    37  	args.ApiVersion = pulumi.StringPtr("v1")
    38  	args.Kind = pulumi.StringPtr("Namespace")
    39  	var resource Namespace
    40  	err := ctx.RegisterResource("kubernetes:core/v1:Namespace", name, args, &resource, opts...)
    41  	if err != nil {
    42  		return nil, err
    43  	}
    44  	return &resource, nil
    45  }
    46  
    47  // GetNamespace gets an existing Namespace resource's state with the given name, ID, and optional
    48  // state properties that are used to uniquely qualify the lookup (nil if not required).
    49  func GetNamespace(ctx *pulumi.Context,
    50  	name string, id pulumi.IDInput, state *NamespaceState, opts ...pulumi.ResourceOption) (*Namespace, error) {
    51  	var resource Namespace
    52  	err := ctx.ReadResource("kubernetes:core/v1:Namespace", name, id, state, &resource, opts...)
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  	return &resource, nil
    57  }
    58  
    59  // Input properties used for looking up and filtering Namespace resources.
    60  type namespaceState struct {
    61  }
    62  
    63  type NamespaceState struct {
    64  }
    65  
    66  func (NamespaceState) ElementType() reflect.Type {
    67  	return reflect.TypeOf((*namespaceState)(nil)).Elem()
    68  }
    69  
    70  type namespaceArgs struct {
    71  	// 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
    72  	ApiVersion *string `pulumi:"apiVersion"`
    73  	// 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
    74  	Kind *string `pulumi:"kind"`
    75  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    76  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
    77  	// Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    78  	Spec *NamespaceSpec `pulumi:"spec"`
    79  }
    80  
    81  // The set of arguments for constructing a Namespace resource.
    82  type NamespaceArgs struct {
    83  	// 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
    84  	ApiVersion pulumi.StringPtrInput
    85  	// 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
    86  	Kind pulumi.StringPtrInput
    87  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    88  	Metadata metav1.ObjectMetaPtrInput
    89  	// Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    90  	Spec NamespaceSpecPtrInput
    91  }
    92  
    93  func (NamespaceArgs) ElementType() reflect.Type {
    94  	return reflect.TypeOf((*namespaceArgs)(nil)).Elem()
    95  }
    96  
    97  type NamespaceInput interface {
    98  	pulumi.Input
    99  
   100  	ToNamespaceOutput() NamespaceOutput
   101  	ToNamespaceOutputWithContext(ctx context.Context) NamespaceOutput
   102  }
   103  
   104  func (*Namespace) ElementType() reflect.Type {
   105  	return reflect.TypeOf((**Namespace)(nil)).Elem()
   106  }
   107  
   108  func (i *Namespace) ToNamespaceOutput() NamespaceOutput {
   109  	return i.ToNamespaceOutputWithContext(context.Background())
   110  }
   111  
   112  func (i *Namespace) ToNamespaceOutputWithContext(ctx context.Context) NamespaceOutput {
   113  	return pulumi.ToOutputWithContext(ctx, i).(NamespaceOutput)
   114  }
   115  
   116  // NamespaceArrayInput is an input type that accepts NamespaceArray and NamespaceArrayOutput values.
   117  // You can construct a concrete instance of `NamespaceArrayInput` via:
   118  //
   119  //	NamespaceArray{ NamespaceArgs{...} }
   120  type NamespaceArrayInput interface {
   121  	pulumi.Input
   122  
   123  	ToNamespaceArrayOutput() NamespaceArrayOutput
   124  	ToNamespaceArrayOutputWithContext(context.Context) NamespaceArrayOutput
   125  }
   126  
   127  type NamespaceArray []NamespaceInput
   128  
   129  func (NamespaceArray) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*[]*Namespace)(nil)).Elem()
   131  }
   132  
   133  func (i NamespaceArray) ToNamespaceArrayOutput() NamespaceArrayOutput {
   134  	return i.ToNamespaceArrayOutputWithContext(context.Background())
   135  }
   136  
   137  func (i NamespaceArray) ToNamespaceArrayOutputWithContext(ctx context.Context) NamespaceArrayOutput {
   138  	return pulumi.ToOutputWithContext(ctx, i).(NamespaceArrayOutput)
   139  }
   140  
   141  // NamespaceMapInput is an input type that accepts NamespaceMap and NamespaceMapOutput values.
   142  // You can construct a concrete instance of `NamespaceMapInput` via:
   143  //
   144  //	NamespaceMap{ "key": NamespaceArgs{...} }
   145  type NamespaceMapInput interface {
   146  	pulumi.Input
   147  
   148  	ToNamespaceMapOutput() NamespaceMapOutput
   149  	ToNamespaceMapOutputWithContext(context.Context) NamespaceMapOutput
   150  }
   151  
   152  type NamespaceMap map[string]NamespaceInput
   153  
   154  func (NamespaceMap) ElementType() reflect.Type {
   155  	return reflect.TypeOf((*map[string]*Namespace)(nil)).Elem()
   156  }
   157  
   158  func (i NamespaceMap) ToNamespaceMapOutput() NamespaceMapOutput {
   159  	return i.ToNamespaceMapOutputWithContext(context.Background())
   160  }
   161  
   162  func (i NamespaceMap) ToNamespaceMapOutputWithContext(ctx context.Context) NamespaceMapOutput {
   163  	return pulumi.ToOutputWithContext(ctx, i).(NamespaceMapOutput)
   164  }
   165  
   166  type NamespaceOutput struct{ *pulumi.OutputState }
   167  
   168  func (NamespaceOutput) ElementType() reflect.Type {
   169  	return reflect.TypeOf((**Namespace)(nil)).Elem()
   170  }
   171  
   172  func (o NamespaceOutput) ToNamespaceOutput() NamespaceOutput {
   173  	return o
   174  }
   175  
   176  func (o NamespaceOutput) ToNamespaceOutputWithContext(ctx context.Context) NamespaceOutput {
   177  	return o
   178  }
   179  
   180  // 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
   181  func (o NamespaceOutput) ApiVersion() pulumi.StringPtrOutput {
   182  	return o.ApplyT(func(v *Namespace) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   183  }
   184  
   185  // 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
   186  func (o NamespaceOutput) Kind() pulumi.StringPtrOutput {
   187  	return o.ApplyT(func(v *Namespace) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   188  }
   189  
   190  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   191  func (o NamespaceOutput) Metadata() metav1.ObjectMetaPtrOutput {
   192  	return o.ApplyT(func(v *Namespace) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   193  }
   194  
   195  // Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   196  func (o NamespaceOutput) Spec() NamespaceSpecPtrOutput {
   197  	return o.ApplyT(func(v *Namespace) NamespaceSpecPtrOutput { return v.Spec }).(NamespaceSpecPtrOutput)
   198  }
   199  
   200  // Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   201  func (o NamespaceOutput) Status() NamespaceStatusPtrOutput {
   202  	return o.ApplyT(func(v *Namespace) NamespaceStatusPtrOutput { return v.Status }).(NamespaceStatusPtrOutput)
   203  }
   204  
   205  type NamespaceArrayOutput struct{ *pulumi.OutputState }
   206  
   207  func (NamespaceArrayOutput) ElementType() reflect.Type {
   208  	return reflect.TypeOf((*[]*Namespace)(nil)).Elem()
   209  }
   210  
   211  func (o NamespaceArrayOutput) ToNamespaceArrayOutput() NamespaceArrayOutput {
   212  	return o
   213  }
   214  
   215  func (o NamespaceArrayOutput) ToNamespaceArrayOutputWithContext(ctx context.Context) NamespaceArrayOutput {
   216  	return o
   217  }
   218  
   219  func (o NamespaceArrayOutput) Index(i pulumi.IntInput) NamespaceOutput {
   220  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Namespace {
   221  		return vs[0].([]*Namespace)[vs[1].(int)]
   222  	}).(NamespaceOutput)
   223  }
   224  
   225  type NamespaceMapOutput struct{ *pulumi.OutputState }
   226  
   227  func (NamespaceMapOutput) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*map[string]*Namespace)(nil)).Elem()
   229  }
   230  
   231  func (o NamespaceMapOutput) ToNamespaceMapOutput() NamespaceMapOutput {
   232  	return o
   233  }
   234  
   235  func (o NamespaceMapOutput) ToNamespaceMapOutputWithContext(ctx context.Context) NamespaceMapOutput {
   236  	return o
   237  }
   238  
   239  func (o NamespaceMapOutput) MapIndex(k pulumi.StringInput) NamespaceOutput {
   240  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Namespace {
   241  		return vs[0].(map[string]*Namespace)[vs[1].(string)]
   242  	}).(NamespaceOutput)
   243  }
   244  
   245  func init() {
   246  	pulumi.RegisterInputType(reflect.TypeOf((*NamespaceInput)(nil)).Elem(), &Namespace{})
   247  	pulumi.RegisterInputType(reflect.TypeOf((*NamespaceArrayInput)(nil)).Elem(), NamespaceArray{})
   248  	pulumi.RegisterInputType(reflect.TypeOf((*NamespaceMapInput)(nil)).Elem(), NamespaceMap{})
   249  	pulumi.RegisterOutputType(NamespaceOutput{})
   250  	pulumi.RegisterOutputType(NamespaceArrayOutput{})
   251  	pulumi.RegisterOutputType(NamespaceMapOutput{})
   252  }