github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/resource/v1alpha1/resourceClass.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 v1alpha1
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/core/v1"
    12  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    13  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    14  )
    15  
    16  // ResourceClass is used by administrators to influence how resources are allocated.
    17  //
    18  // This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
    19  type ResourceClass struct {
    20  	pulumi.CustomResourceState
    21  
    22  	// 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
    23  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    24  	// DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.
    25  	//
    26  	// Resource drivers have a unique name in forward domain order (acme.example.com).
    27  	DriverName pulumi.StringOutput `pulumi:"driverName"`
    28  	// 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
    29  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    30  	// Standard object metadata
    31  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    32  	// ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.
    33  	ParametersRef ResourceClassParametersReferencePtrOutput `pulumi:"parametersRef"`
    34  	// Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.
    35  	//
    36  	// Setting this field is optional. If null, all nodes are candidates.
    37  	SuitableNodes corev1.NodeSelectorPtrOutput `pulumi:"suitableNodes"`
    38  }
    39  
    40  // NewResourceClass registers a new resource with the given unique name, arguments, and options.
    41  func NewResourceClass(ctx *pulumi.Context,
    42  	name string, args *ResourceClassArgs, opts ...pulumi.ResourceOption) (*ResourceClass, error) {
    43  	if args == nil {
    44  		return nil, errors.New("missing one or more required arguments")
    45  	}
    46  
    47  	if args.DriverName == nil {
    48  		return nil, errors.New("invalid value for required argument 'DriverName'")
    49  	}
    50  	args.ApiVersion = pulumi.StringPtr("resource.k8s.io/v1alpha1")
    51  	args.Kind = pulumi.StringPtr("ResourceClass")
    52  	aliases := pulumi.Aliases([]pulumi.Alias{
    53  		{
    54  			Type: pulumi.String("kubernetes:resource.k8s.io/v1alpha2:ResourceClass"),
    55  		},
    56  	})
    57  	opts = append(opts, aliases)
    58  	var resource ResourceClass
    59  	err := ctx.RegisterResource("kubernetes:resource.k8s.io/v1alpha1:ResourceClass", name, args, &resource, opts...)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	return &resource, nil
    64  }
    65  
    66  // GetResourceClass gets an existing ResourceClass resource's state with the given name, ID, and optional
    67  // state properties that are used to uniquely qualify the lookup (nil if not required).
    68  func GetResourceClass(ctx *pulumi.Context,
    69  	name string, id pulumi.IDInput, state *ResourceClassState, opts ...pulumi.ResourceOption) (*ResourceClass, error) {
    70  	var resource ResourceClass
    71  	err := ctx.ReadResource("kubernetes:resource.k8s.io/v1alpha1:ResourceClass", name, id, state, &resource, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return &resource, nil
    76  }
    77  
    78  // Input properties used for looking up and filtering ResourceClass resources.
    79  type resourceClassState struct {
    80  }
    81  
    82  type ResourceClassState struct {
    83  }
    84  
    85  func (ResourceClassState) ElementType() reflect.Type {
    86  	return reflect.TypeOf((*resourceClassState)(nil)).Elem()
    87  }
    88  
    89  type resourceClassArgs struct {
    90  	// 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
    91  	ApiVersion *string `pulumi:"apiVersion"`
    92  	// DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.
    93  	//
    94  	// Resource drivers have a unique name in forward domain order (acme.example.com).
    95  	DriverName string `pulumi:"driverName"`
    96  	// 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
    97  	Kind *string `pulumi:"kind"`
    98  	// Standard object metadata
    99  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
   100  	// ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.
   101  	ParametersRef *ResourceClassParametersReference `pulumi:"parametersRef"`
   102  	// Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.
   103  	//
   104  	// Setting this field is optional. If null, all nodes are candidates.
   105  	SuitableNodes *corev1.NodeSelector `pulumi:"suitableNodes"`
   106  }
   107  
   108  // The set of arguments for constructing a ResourceClass resource.
   109  type ResourceClassArgs struct {
   110  	// 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
   111  	ApiVersion pulumi.StringPtrInput
   112  	// DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.
   113  	//
   114  	// Resource drivers have a unique name in forward domain order (acme.example.com).
   115  	DriverName pulumi.StringInput
   116  	// 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
   117  	Kind pulumi.StringPtrInput
   118  	// Standard object metadata
   119  	Metadata metav1.ObjectMetaPtrInput
   120  	// ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.
   121  	ParametersRef ResourceClassParametersReferencePtrInput
   122  	// Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.
   123  	//
   124  	// Setting this field is optional. If null, all nodes are candidates.
   125  	SuitableNodes corev1.NodeSelectorPtrInput
   126  }
   127  
   128  func (ResourceClassArgs) ElementType() reflect.Type {
   129  	return reflect.TypeOf((*resourceClassArgs)(nil)).Elem()
   130  }
   131  
   132  type ResourceClassInput interface {
   133  	pulumi.Input
   134  
   135  	ToResourceClassOutput() ResourceClassOutput
   136  	ToResourceClassOutputWithContext(ctx context.Context) ResourceClassOutput
   137  }
   138  
   139  func (*ResourceClass) ElementType() reflect.Type {
   140  	return reflect.TypeOf((**ResourceClass)(nil)).Elem()
   141  }
   142  
   143  func (i *ResourceClass) ToResourceClassOutput() ResourceClassOutput {
   144  	return i.ToResourceClassOutputWithContext(context.Background())
   145  }
   146  
   147  func (i *ResourceClass) ToResourceClassOutputWithContext(ctx context.Context) ResourceClassOutput {
   148  	return pulumi.ToOutputWithContext(ctx, i).(ResourceClassOutput)
   149  }
   150  
   151  // ResourceClassArrayInput is an input type that accepts ResourceClassArray and ResourceClassArrayOutput values.
   152  // You can construct a concrete instance of `ResourceClassArrayInput` via:
   153  //
   154  //	ResourceClassArray{ ResourceClassArgs{...} }
   155  type ResourceClassArrayInput interface {
   156  	pulumi.Input
   157  
   158  	ToResourceClassArrayOutput() ResourceClassArrayOutput
   159  	ToResourceClassArrayOutputWithContext(context.Context) ResourceClassArrayOutput
   160  }
   161  
   162  type ResourceClassArray []ResourceClassInput
   163  
   164  func (ResourceClassArray) ElementType() reflect.Type {
   165  	return reflect.TypeOf((*[]*ResourceClass)(nil)).Elem()
   166  }
   167  
   168  func (i ResourceClassArray) ToResourceClassArrayOutput() ResourceClassArrayOutput {
   169  	return i.ToResourceClassArrayOutputWithContext(context.Background())
   170  }
   171  
   172  func (i ResourceClassArray) ToResourceClassArrayOutputWithContext(ctx context.Context) ResourceClassArrayOutput {
   173  	return pulumi.ToOutputWithContext(ctx, i).(ResourceClassArrayOutput)
   174  }
   175  
   176  // ResourceClassMapInput is an input type that accepts ResourceClassMap and ResourceClassMapOutput values.
   177  // You can construct a concrete instance of `ResourceClassMapInput` via:
   178  //
   179  //	ResourceClassMap{ "key": ResourceClassArgs{...} }
   180  type ResourceClassMapInput interface {
   181  	pulumi.Input
   182  
   183  	ToResourceClassMapOutput() ResourceClassMapOutput
   184  	ToResourceClassMapOutputWithContext(context.Context) ResourceClassMapOutput
   185  }
   186  
   187  type ResourceClassMap map[string]ResourceClassInput
   188  
   189  func (ResourceClassMap) ElementType() reflect.Type {
   190  	return reflect.TypeOf((*map[string]*ResourceClass)(nil)).Elem()
   191  }
   192  
   193  func (i ResourceClassMap) ToResourceClassMapOutput() ResourceClassMapOutput {
   194  	return i.ToResourceClassMapOutputWithContext(context.Background())
   195  }
   196  
   197  func (i ResourceClassMap) ToResourceClassMapOutputWithContext(ctx context.Context) ResourceClassMapOutput {
   198  	return pulumi.ToOutputWithContext(ctx, i).(ResourceClassMapOutput)
   199  }
   200  
   201  type ResourceClassOutput struct{ *pulumi.OutputState }
   202  
   203  func (ResourceClassOutput) ElementType() reflect.Type {
   204  	return reflect.TypeOf((**ResourceClass)(nil)).Elem()
   205  }
   206  
   207  func (o ResourceClassOutput) ToResourceClassOutput() ResourceClassOutput {
   208  	return o
   209  }
   210  
   211  func (o ResourceClassOutput) ToResourceClassOutputWithContext(ctx context.Context) ResourceClassOutput {
   212  	return o
   213  }
   214  
   215  // 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
   216  func (o ResourceClassOutput) ApiVersion() pulumi.StringPtrOutput {
   217  	return o.ApplyT(func(v *ResourceClass) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   218  }
   219  
   220  // DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.
   221  //
   222  // Resource drivers have a unique name in forward domain order (acme.example.com).
   223  func (o ResourceClassOutput) DriverName() pulumi.StringOutput {
   224  	return o.ApplyT(func(v *ResourceClass) pulumi.StringOutput { return v.DriverName }).(pulumi.StringOutput)
   225  }
   226  
   227  // 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
   228  func (o ResourceClassOutput) Kind() pulumi.StringPtrOutput {
   229  	return o.ApplyT(func(v *ResourceClass) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   230  }
   231  
   232  // Standard object metadata
   233  func (o ResourceClassOutput) Metadata() metav1.ObjectMetaPtrOutput {
   234  	return o.ApplyT(func(v *ResourceClass) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput)
   235  }
   236  
   237  // ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.
   238  func (o ResourceClassOutput) ParametersRef() ResourceClassParametersReferencePtrOutput {
   239  	return o.ApplyT(func(v *ResourceClass) ResourceClassParametersReferencePtrOutput { return v.ParametersRef }).(ResourceClassParametersReferencePtrOutput)
   240  }
   241  
   242  // Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.
   243  //
   244  // Setting this field is optional. If null, all nodes are candidates.
   245  func (o ResourceClassOutput) SuitableNodes() corev1.NodeSelectorPtrOutput {
   246  	return o.ApplyT(func(v *ResourceClass) corev1.NodeSelectorPtrOutput { return v.SuitableNodes }).(corev1.NodeSelectorPtrOutput)
   247  }
   248  
   249  type ResourceClassArrayOutput struct{ *pulumi.OutputState }
   250  
   251  func (ResourceClassArrayOutput) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*ResourceClass)(nil)).Elem()
   253  }
   254  
   255  func (o ResourceClassArrayOutput) ToResourceClassArrayOutput() ResourceClassArrayOutput {
   256  	return o
   257  }
   258  
   259  func (o ResourceClassArrayOutput) ToResourceClassArrayOutputWithContext(ctx context.Context) ResourceClassArrayOutput {
   260  	return o
   261  }
   262  
   263  func (o ResourceClassArrayOutput) Index(i pulumi.IntInput) ResourceClassOutput {
   264  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceClass {
   265  		return vs[0].([]*ResourceClass)[vs[1].(int)]
   266  	}).(ResourceClassOutput)
   267  }
   268  
   269  type ResourceClassMapOutput struct{ *pulumi.OutputState }
   270  
   271  func (ResourceClassMapOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*map[string]*ResourceClass)(nil)).Elem()
   273  }
   274  
   275  func (o ResourceClassMapOutput) ToResourceClassMapOutput() ResourceClassMapOutput {
   276  	return o
   277  }
   278  
   279  func (o ResourceClassMapOutput) ToResourceClassMapOutputWithContext(ctx context.Context) ResourceClassMapOutput {
   280  	return o
   281  }
   282  
   283  func (o ResourceClassMapOutput) MapIndex(k pulumi.StringInput) ResourceClassOutput {
   284  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceClass {
   285  		return vs[0].(map[string]*ResourceClass)[vs[1].(string)]
   286  	}).(ResourceClassOutput)
   287  }
   288  
   289  func init() {
   290  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceClassInput)(nil)).Elem(), &ResourceClass{})
   291  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceClassArrayInput)(nil)).Elem(), ResourceClassArray{})
   292  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceClassMapInput)(nil)).Elem(), ResourceClassMap{})
   293  	pulumi.RegisterOutputType(ResourceClassOutput{})
   294  	pulumi.RegisterOutputType(ResourceClassArrayOutput{})
   295  	pulumi.RegisterOutputType(ResourceClassMapOutput{})
   296  }