github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/scheduling/v1/priorityClass.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  	"errors"
    11  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.
    16  type PriorityClass struct {
    17  	pulumi.CustomResourceState
    18  
    19  	// 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
    20  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    21  	// description is an arbitrary string that usually provides guidelines on when this priority class should be used.
    22  	Description pulumi.StringPtrOutput `pulumi:"description"`
    23  	// globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.
    24  	GlobalDefault pulumi.BoolPtrOutput `pulumi:"globalDefault"`
    25  	// 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
    26  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    27  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    28  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    29  	// preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.
    30  	PreemptionPolicy pulumi.StringPtrOutput `pulumi:"preemptionPolicy"`
    31  	// value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.
    32  	Value pulumi.IntOutput `pulumi:"value"`
    33  }
    34  
    35  // NewPriorityClass registers a new resource with the given unique name, arguments, and options.
    36  func NewPriorityClass(ctx *pulumi.Context,
    37  	name string, args *PriorityClassArgs, opts ...pulumi.ResourceOption) (*PriorityClass, error) {
    38  	if args == nil {
    39  		return nil, errors.New("missing one or more required arguments")
    40  	}
    41  
    42  	if args.Value == nil {
    43  		return nil, errors.New("invalid value for required argument 'Value'")
    44  	}
    45  	args.ApiVersion = pulumi.StringPtr("scheduling.k8s.io/v1")
    46  	args.Kind = pulumi.StringPtr("PriorityClass")
    47  	aliases := pulumi.Aliases([]pulumi.Alias{
    48  		{
    49  			Type: pulumi.String("kubernetes:scheduling.k8s.io/v1alpha1:PriorityClass"),
    50  		},
    51  		{
    52  			Type: pulumi.String("kubernetes:scheduling.k8s.io/v1beta1:PriorityClass"),
    53  		},
    54  	})
    55  	opts = append(opts, aliases)
    56  	var resource PriorityClass
    57  	err := ctx.RegisterResource("kubernetes:scheduling.k8s.io/v1:PriorityClass", name, args, &resource, opts...)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	return &resource, nil
    62  }
    63  
    64  // GetPriorityClass gets an existing PriorityClass resource's state with the given name, ID, and optional
    65  // state properties that are used to uniquely qualify the lookup (nil if not required).
    66  func GetPriorityClass(ctx *pulumi.Context,
    67  	name string, id pulumi.IDInput, state *PriorityClassState, opts ...pulumi.ResourceOption) (*PriorityClass, error) {
    68  	var resource PriorityClass
    69  	err := ctx.ReadResource("kubernetes:scheduling.k8s.io/v1:PriorityClass", name, id, state, &resource, opts...)
    70  	if err != nil {
    71  		return nil, err
    72  	}
    73  	return &resource, nil
    74  }
    75  
    76  // Input properties used for looking up and filtering PriorityClass resources.
    77  type priorityClassState struct {
    78  }
    79  
    80  type PriorityClassState struct {
    81  }
    82  
    83  func (PriorityClassState) ElementType() reflect.Type {
    84  	return reflect.TypeOf((*priorityClassState)(nil)).Elem()
    85  }
    86  
    87  type priorityClassArgs struct {
    88  	// 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
    89  	ApiVersion *string `pulumi:"apiVersion"`
    90  	// description is an arbitrary string that usually provides guidelines on when this priority class should be used.
    91  	Description *string `pulumi:"description"`
    92  	// globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.
    93  	GlobalDefault *bool `pulumi:"globalDefault"`
    94  	// 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
    95  	Kind *string `pulumi:"kind"`
    96  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    97  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
    98  	// preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.
    99  	PreemptionPolicy *string `pulumi:"preemptionPolicy"`
   100  	// value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.
   101  	Value int `pulumi:"value"`
   102  }
   103  
   104  // The set of arguments for constructing a PriorityClass resource.
   105  type PriorityClassArgs struct {
   106  	// 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
   107  	ApiVersion pulumi.StringPtrInput
   108  	// description is an arbitrary string that usually provides guidelines on when this priority class should be used.
   109  	Description pulumi.StringPtrInput
   110  	// globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.
   111  	GlobalDefault pulumi.BoolPtrInput
   112  	// 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
   113  	Kind pulumi.StringPtrInput
   114  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   115  	Metadata metav1.ObjectMetaPtrInput
   116  	// preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.
   117  	PreemptionPolicy pulumi.StringPtrInput
   118  	// value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.
   119  	Value pulumi.IntInput
   120  }
   121  
   122  func (PriorityClassArgs) ElementType() reflect.Type {
   123  	return reflect.TypeOf((*priorityClassArgs)(nil)).Elem()
   124  }
   125  
   126  type PriorityClassInput interface {
   127  	pulumi.Input
   128  
   129  	ToPriorityClassOutput() PriorityClassOutput
   130  	ToPriorityClassOutputWithContext(ctx context.Context) PriorityClassOutput
   131  }
   132  
   133  func (*PriorityClass) ElementType() reflect.Type {
   134  	return reflect.TypeOf((**PriorityClass)(nil)).Elem()
   135  }
   136  
   137  func (i *PriorityClass) ToPriorityClassOutput() PriorityClassOutput {
   138  	return i.ToPriorityClassOutputWithContext(context.Background())
   139  }
   140  
   141  func (i *PriorityClass) ToPriorityClassOutputWithContext(ctx context.Context) PriorityClassOutput {
   142  	return pulumi.ToOutputWithContext(ctx, i).(PriorityClassOutput)
   143  }
   144  
   145  // PriorityClassArrayInput is an input type that accepts PriorityClassArray and PriorityClassArrayOutput values.
   146  // You can construct a concrete instance of `PriorityClassArrayInput` via:
   147  //
   148  //	PriorityClassArray{ PriorityClassArgs{...} }
   149  type PriorityClassArrayInput interface {
   150  	pulumi.Input
   151  
   152  	ToPriorityClassArrayOutput() PriorityClassArrayOutput
   153  	ToPriorityClassArrayOutputWithContext(context.Context) PriorityClassArrayOutput
   154  }
   155  
   156  type PriorityClassArray []PriorityClassInput
   157  
   158  func (PriorityClassArray) ElementType() reflect.Type {
   159  	return reflect.TypeOf((*[]*PriorityClass)(nil)).Elem()
   160  }
   161  
   162  func (i PriorityClassArray) ToPriorityClassArrayOutput() PriorityClassArrayOutput {
   163  	return i.ToPriorityClassArrayOutputWithContext(context.Background())
   164  }
   165  
   166  func (i PriorityClassArray) ToPriorityClassArrayOutputWithContext(ctx context.Context) PriorityClassArrayOutput {
   167  	return pulumi.ToOutputWithContext(ctx, i).(PriorityClassArrayOutput)
   168  }
   169  
   170  // PriorityClassMapInput is an input type that accepts PriorityClassMap and PriorityClassMapOutput values.
   171  // You can construct a concrete instance of `PriorityClassMapInput` via:
   172  //
   173  //	PriorityClassMap{ "key": PriorityClassArgs{...} }
   174  type PriorityClassMapInput interface {
   175  	pulumi.Input
   176  
   177  	ToPriorityClassMapOutput() PriorityClassMapOutput
   178  	ToPriorityClassMapOutputWithContext(context.Context) PriorityClassMapOutput
   179  }
   180  
   181  type PriorityClassMap map[string]PriorityClassInput
   182  
   183  func (PriorityClassMap) ElementType() reflect.Type {
   184  	return reflect.TypeOf((*map[string]*PriorityClass)(nil)).Elem()
   185  }
   186  
   187  func (i PriorityClassMap) ToPriorityClassMapOutput() PriorityClassMapOutput {
   188  	return i.ToPriorityClassMapOutputWithContext(context.Background())
   189  }
   190  
   191  func (i PriorityClassMap) ToPriorityClassMapOutputWithContext(ctx context.Context) PriorityClassMapOutput {
   192  	return pulumi.ToOutputWithContext(ctx, i).(PriorityClassMapOutput)
   193  }
   194  
   195  type PriorityClassOutput struct{ *pulumi.OutputState }
   196  
   197  func (PriorityClassOutput) ElementType() reflect.Type {
   198  	return reflect.TypeOf((**PriorityClass)(nil)).Elem()
   199  }
   200  
   201  func (o PriorityClassOutput) ToPriorityClassOutput() PriorityClassOutput {
   202  	return o
   203  }
   204  
   205  func (o PriorityClassOutput) ToPriorityClassOutputWithContext(ctx context.Context) PriorityClassOutput {
   206  	return o
   207  }
   208  
   209  // 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
   210  func (o PriorityClassOutput) ApiVersion() pulumi.StringPtrOutput {
   211  	return o.ApplyT(func(v *PriorityClass) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   212  }
   213  
   214  // description is an arbitrary string that usually provides guidelines on when this priority class should be used.
   215  func (o PriorityClassOutput) Description() pulumi.StringPtrOutput {
   216  	return o.ApplyT(func(v *PriorityClass) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   217  }
   218  
   219  // globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.
   220  func (o PriorityClassOutput) GlobalDefault() pulumi.BoolPtrOutput {
   221  	return o.ApplyT(func(v *PriorityClass) pulumi.BoolPtrOutput { return v.GlobalDefault }).(pulumi.BoolPtrOutput)
   222  }
   223  
   224  // 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
   225  func (o PriorityClassOutput) Kind() pulumi.StringPtrOutput {
   226  	return o.ApplyT(func(v *PriorityClass) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   227  }
   228  
   229  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   230  func (o PriorityClassOutput) Metadata() metav1.ObjectMetaPtrOutput {
   231  	return o.ApplyT(func(v *PriorityClass) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   232  }
   233  
   234  // preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.
   235  func (o PriorityClassOutput) PreemptionPolicy() pulumi.StringPtrOutput {
   236  	return o.ApplyT(func(v *PriorityClass) pulumi.StringPtrOutput { return v.PreemptionPolicy }).(pulumi.StringPtrOutput)
   237  }
   238  
   239  // value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.
   240  func (o PriorityClassOutput) Value() pulumi.IntOutput {
   241  	return o.ApplyT(func(v *PriorityClass) pulumi.IntOutput { return v.Value }).(pulumi.IntOutput)
   242  }
   243  
   244  type PriorityClassArrayOutput struct{ *pulumi.OutputState }
   245  
   246  func (PriorityClassArrayOutput) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*[]*PriorityClass)(nil)).Elem()
   248  }
   249  
   250  func (o PriorityClassArrayOutput) ToPriorityClassArrayOutput() PriorityClassArrayOutput {
   251  	return o
   252  }
   253  
   254  func (o PriorityClassArrayOutput) ToPriorityClassArrayOutputWithContext(ctx context.Context) PriorityClassArrayOutput {
   255  	return o
   256  }
   257  
   258  func (o PriorityClassArrayOutput) Index(i pulumi.IntInput) PriorityClassOutput {
   259  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PriorityClass {
   260  		return vs[0].([]*PriorityClass)[vs[1].(int)]
   261  	}).(PriorityClassOutput)
   262  }
   263  
   264  type PriorityClassMapOutput struct{ *pulumi.OutputState }
   265  
   266  func (PriorityClassMapOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*map[string]*PriorityClass)(nil)).Elem()
   268  }
   269  
   270  func (o PriorityClassMapOutput) ToPriorityClassMapOutput() PriorityClassMapOutput {
   271  	return o
   272  }
   273  
   274  func (o PriorityClassMapOutput) ToPriorityClassMapOutputWithContext(ctx context.Context) PriorityClassMapOutput {
   275  	return o
   276  }
   277  
   278  func (o PriorityClassMapOutput) MapIndex(k pulumi.StringInput) PriorityClassOutput {
   279  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PriorityClass {
   280  		return vs[0].(map[string]*PriorityClass)[vs[1].(string)]
   281  	}).(PriorityClassOutput)
   282  }
   283  
   284  func init() {
   285  	pulumi.RegisterInputType(reflect.TypeOf((*PriorityClassInput)(nil)).Elem(), &PriorityClass{})
   286  	pulumi.RegisterInputType(reflect.TypeOf((*PriorityClassArrayInput)(nil)).Elem(), PriorityClassArray{})
   287  	pulumi.RegisterInputType(reflect.TypeOf((*PriorityClassMapInput)(nil)).Elem(), PriorityClassMap{})
   288  	pulumi.RegisterOutputType(PriorityClassOutput{})
   289  	pulumi.RegisterOutputType(PriorityClassArrayOutput{})
   290  	pulumi.RegisterOutputType(PriorityClassMapOutput{})
   291  }