github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/resource/v1alpha1/resourceClaim.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 metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // ResourceClaim describes which resources are needed by a resource consumer. Its status tracks whether the resource has been allocated and what the resulting attributes are. 16 // 17 // This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. 18 type ResourceClaim struct { 19 pulumi.CustomResourceState 20 21 // 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 22 ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"` 23 // 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 24 Kind pulumi.StringPtrOutput `pulumi:"kind"` 25 // Standard object metadata 26 Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"` 27 // Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim. 28 Spec ResourceClaimSpecOutput `pulumi:"spec"` 29 // Status describes whether the resource is available and with which attributes. 30 Status ResourceClaimStatusPtrOutput `pulumi:"status"` 31 } 32 33 // NewResourceClaim registers a new resource with the given unique name, arguments, and options. 34 func NewResourceClaim(ctx *pulumi.Context, 35 name string, args *ResourceClaimArgs, opts ...pulumi.ResourceOption) (*ResourceClaim, error) { 36 if args == nil { 37 return nil, errors.New("missing one or more required arguments") 38 } 39 40 if args.Spec == nil { 41 return nil, errors.New("invalid value for required argument 'Spec'") 42 } 43 args.ApiVersion = pulumi.StringPtr("resource.k8s.io/v1alpha1") 44 args.Kind = pulumi.StringPtr("ResourceClaim") 45 aliases := pulumi.Aliases([]pulumi.Alias{ 46 { 47 Type: pulumi.String("kubernetes:resource.k8s.io/v1alpha2:ResourceClaim"), 48 }, 49 }) 50 opts = append(opts, aliases) 51 var resource ResourceClaim 52 err := ctx.RegisterResource("kubernetes:resource.k8s.io/v1alpha1:ResourceClaim", name, args, &resource, opts...) 53 if err != nil { 54 return nil, err 55 } 56 return &resource, nil 57 } 58 59 // GetResourceClaim gets an existing ResourceClaim resource's state with the given name, ID, and optional 60 // state properties that are used to uniquely qualify the lookup (nil if not required). 61 func GetResourceClaim(ctx *pulumi.Context, 62 name string, id pulumi.IDInput, state *ResourceClaimState, opts ...pulumi.ResourceOption) (*ResourceClaim, error) { 63 var resource ResourceClaim 64 err := ctx.ReadResource("kubernetes:resource.k8s.io/v1alpha1:ResourceClaim", name, id, state, &resource, opts...) 65 if err != nil { 66 return nil, err 67 } 68 return &resource, nil 69 } 70 71 // Input properties used for looking up and filtering ResourceClaim resources. 72 type resourceClaimState struct { 73 } 74 75 type ResourceClaimState struct { 76 } 77 78 func (ResourceClaimState) ElementType() reflect.Type { 79 return reflect.TypeOf((*resourceClaimState)(nil)).Elem() 80 } 81 82 type resourceClaimArgs 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 *string `pulumi:"apiVersion"` 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 *string `pulumi:"kind"` 87 // Standard object metadata 88 Metadata *metav1.ObjectMeta `pulumi:"metadata"` 89 // Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim. 90 Spec ResourceClaimSpec `pulumi:"spec"` 91 } 92 93 // The set of arguments for constructing a ResourceClaim resource. 94 type ResourceClaimArgs struct { 95 // 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 96 ApiVersion pulumi.StringPtrInput 97 // 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 98 Kind pulumi.StringPtrInput 99 // Standard object metadata 100 Metadata metav1.ObjectMetaPtrInput 101 // Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim. 102 Spec ResourceClaimSpecInput 103 } 104 105 func (ResourceClaimArgs) ElementType() reflect.Type { 106 return reflect.TypeOf((*resourceClaimArgs)(nil)).Elem() 107 } 108 109 type ResourceClaimInput interface { 110 pulumi.Input 111 112 ToResourceClaimOutput() ResourceClaimOutput 113 ToResourceClaimOutputWithContext(ctx context.Context) ResourceClaimOutput 114 } 115 116 func (*ResourceClaim) ElementType() reflect.Type { 117 return reflect.TypeOf((**ResourceClaim)(nil)).Elem() 118 } 119 120 func (i *ResourceClaim) ToResourceClaimOutput() ResourceClaimOutput { 121 return i.ToResourceClaimOutputWithContext(context.Background()) 122 } 123 124 func (i *ResourceClaim) ToResourceClaimOutputWithContext(ctx context.Context) ResourceClaimOutput { 125 return pulumi.ToOutputWithContext(ctx, i).(ResourceClaimOutput) 126 } 127 128 // ResourceClaimArrayInput is an input type that accepts ResourceClaimArray and ResourceClaimArrayOutput values. 129 // You can construct a concrete instance of `ResourceClaimArrayInput` via: 130 // 131 // ResourceClaimArray{ ResourceClaimArgs{...} } 132 type ResourceClaimArrayInput interface { 133 pulumi.Input 134 135 ToResourceClaimArrayOutput() ResourceClaimArrayOutput 136 ToResourceClaimArrayOutputWithContext(context.Context) ResourceClaimArrayOutput 137 } 138 139 type ResourceClaimArray []ResourceClaimInput 140 141 func (ResourceClaimArray) ElementType() reflect.Type { 142 return reflect.TypeOf((*[]*ResourceClaim)(nil)).Elem() 143 } 144 145 func (i ResourceClaimArray) ToResourceClaimArrayOutput() ResourceClaimArrayOutput { 146 return i.ToResourceClaimArrayOutputWithContext(context.Background()) 147 } 148 149 func (i ResourceClaimArray) ToResourceClaimArrayOutputWithContext(ctx context.Context) ResourceClaimArrayOutput { 150 return pulumi.ToOutputWithContext(ctx, i).(ResourceClaimArrayOutput) 151 } 152 153 // ResourceClaimMapInput is an input type that accepts ResourceClaimMap and ResourceClaimMapOutput values. 154 // You can construct a concrete instance of `ResourceClaimMapInput` via: 155 // 156 // ResourceClaimMap{ "key": ResourceClaimArgs{...} } 157 type ResourceClaimMapInput interface { 158 pulumi.Input 159 160 ToResourceClaimMapOutput() ResourceClaimMapOutput 161 ToResourceClaimMapOutputWithContext(context.Context) ResourceClaimMapOutput 162 } 163 164 type ResourceClaimMap map[string]ResourceClaimInput 165 166 func (ResourceClaimMap) ElementType() reflect.Type { 167 return reflect.TypeOf((*map[string]*ResourceClaim)(nil)).Elem() 168 } 169 170 func (i ResourceClaimMap) ToResourceClaimMapOutput() ResourceClaimMapOutput { 171 return i.ToResourceClaimMapOutputWithContext(context.Background()) 172 } 173 174 func (i ResourceClaimMap) ToResourceClaimMapOutputWithContext(ctx context.Context) ResourceClaimMapOutput { 175 return pulumi.ToOutputWithContext(ctx, i).(ResourceClaimMapOutput) 176 } 177 178 type ResourceClaimOutput struct{ *pulumi.OutputState } 179 180 func (ResourceClaimOutput) ElementType() reflect.Type { 181 return reflect.TypeOf((**ResourceClaim)(nil)).Elem() 182 } 183 184 func (o ResourceClaimOutput) ToResourceClaimOutput() ResourceClaimOutput { 185 return o 186 } 187 188 func (o ResourceClaimOutput) ToResourceClaimOutputWithContext(ctx context.Context) ResourceClaimOutput { 189 return o 190 } 191 192 // 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 193 func (o ResourceClaimOutput) ApiVersion() pulumi.StringPtrOutput { 194 return o.ApplyT(func(v *ResourceClaim) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput) 195 } 196 197 // 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 198 func (o ResourceClaimOutput) Kind() pulumi.StringPtrOutput { 199 return o.ApplyT(func(v *ResourceClaim) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput) 200 } 201 202 // Standard object metadata 203 func (o ResourceClaimOutput) Metadata() metav1.ObjectMetaPtrOutput { 204 return o.ApplyT(func(v *ResourceClaim) metav1.ObjectMetaPtrOutput { return v.Metadata }).(metav1.ObjectMetaPtrOutput) 205 } 206 207 // Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim. 208 func (o ResourceClaimOutput) Spec() ResourceClaimSpecOutput { 209 return o.ApplyT(func(v *ResourceClaim) ResourceClaimSpecOutput { return v.Spec }).(ResourceClaimSpecOutput) 210 } 211 212 // Status describes whether the resource is available and with which attributes. 213 func (o ResourceClaimOutput) Status() ResourceClaimStatusPtrOutput { 214 return o.ApplyT(func(v *ResourceClaim) ResourceClaimStatusPtrOutput { return v.Status }).(ResourceClaimStatusPtrOutput) 215 } 216 217 type ResourceClaimArrayOutput struct{ *pulumi.OutputState } 218 219 func (ResourceClaimArrayOutput) ElementType() reflect.Type { 220 return reflect.TypeOf((*[]*ResourceClaim)(nil)).Elem() 221 } 222 223 func (o ResourceClaimArrayOutput) ToResourceClaimArrayOutput() ResourceClaimArrayOutput { 224 return o 225 } 226 227 func (o ResourceClaimArrayOutput) ToResourceClaimArrayOutputWithContext(ctx context.Context) ResourceClaimArrayOutput { 228 return o 229 } 230 231 func (o ResourceClaimArrayOutput) Index(i pulumi.IntInput) ResourceClaimOutput { 232 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceClaim { 233 return vs[0].([]*ResourceClaim)[vs[1].(int)] 234 }).(ResourceClaimOutput) 235 } 236 237 type ResourceClaimMapOutput struct{ *pulumi.OutputState } 238 239 func (ResourceClaimMapOutput) ElementType() reflect.Type { 240 return reflect.TypeOf((*map[string]*ResourceClaim)(nil)).Elem() 241 } 242 243 func (o ResourceClaimMapOutput) ToResourceClaimMapOutput() ResourceClaimMapOutput { 244 return o 245 } 246 247 func (o ResourceClaimMapOutput) ToResourceClaimMapOutputWithContext(ctx context.Context) ResourceClaimMapOutput { 248 return o 249 } 250 251 func (o ResourceClaimMapOutput) MapIndex(k pulumi.StringInput) ResourceClaimOutput { 252 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceClaim { 253 return vs[0].(map[string]*ResourceClaim)[vs[1].(string)] 254 }).(ResourceClaimOutput) 255 } 256 257 func init() { 258 pulumi.RegisterInputType(reflect.TypeOf((*ResourceClaimInput)(nil)).Elem(), &ResourceClaim{}) 259 pulumi.RegisterInputType(reflect.TypeOf((*ResourceClaimArrayInput)(nil)).Elem(), ResourceClaimArray{}) 260 pulumi.RegisterInputType(reflect.TypeOf((*ResourceClaimMapInput)(nil)).Elem(), ResourceClaimMap{}) 261 pulumi.RegisterOutputType(ResourceClaimOutput{}) 262 pulumi.RegisterOutputType(ResourceClaimArrayOutput{}) 263 pulumi.RegisterOutputType(ResourceClaimMapOutput{}) 264 }