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