github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/apiextensions/customResourcePatch.go (about)

     1  // Copyright 2016-2022, Pulumi Corporation.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // *** WARNING: this file was generated by pulumigen. ***
    16  // *** Do not edit by hand unless you're certain you know what you are doing! ***
    17  
    18  package apiextensions
    19  
    20  import (
    21  	"fmt"
    22  	"reflect"
    23  
    24  	"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
    25  	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/meta/v1"
    26  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  )
    28  
    29  // CustomResourcePatch represents a resource definition we'd use to create an instance of a
    30  // Kubernetes CustomResourceDefinition (CRD). For example, the CoreOS Prometheus operator
    31  // exposes a CRD `monitoring.coreos.com/ServiceMonitor`; to create a `ServiceMonitor`, we'd
    32  // pass a `CustomResourceArgs` containing the `ServiceMonitor` definition to `apiextensions.CustomResourcePatch`.
    33  type CustomResourcePatch struct {
    34  	pulumi.CustomResourceState
    35  
    36  	// 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
    37  	ApiVersion pulumi.StringOutput `pulumi:"apiVersion"`
    38  	// 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
    39  	Kind pulumi.StringOutput `pulumi:"kind"`
    40  	// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
    41  	Metadata metav1.ObjectMetaPtrOutput `pulumi:"metadata"`
    42  	// Untyped map that holds any user-defined fields.
    43  	OtherFields pulumi.MapOutput `pulumi:""`
    44  }
    45  
    46  // NewCustomResourcePatch registers a new resource with the given unique name, arguments, and options.
    47  func NewCustomResourcePatch(ctx *pulumi.Context,
    48  	name string, args *CustomResourcePatchArgs, opts ...pulumi.ResourceOption) (*CustomResourcePatch, error) {
    49  	if args == nil {
    50  		args = &CustomResourcePatchArgs{}
    51  	}
    52  
    53  	untyped := kubernetes.UntypedArgs{}
    54  	for k, v := range args.OtherFields {
    55  		untyped[k] = v
    56  	}
    57  	untyped["apiVersion"] = args.ApiVersion
    58  	untyped["kind"] = args.Kind
    59  	untyped["metadata"] = args.Metadata
    60  
    61  	var resource CustomResourcePatch
    62  	err := ctx.RegisterResource(fmt.Sprintf("kubernetes:%s:%sPatch", args.ApiVersion, args.Kind), name, untyped, &resource, opts...)
    63  	if err != nil {
    64  		return nil, err
    65  	}
    66  	return &resource, nil
    67  }
    68  
    69  type customResourcePatchArgs struct {
    70  	// 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
    71  	ApiVersion string `pulumi:"apiVersion"`
    72  	// 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
    73  	Kind string `pulumi:"kind"`
    74  	// Standard object metadata.
    75  	Metadata *metav1.ObjectMeta `pulumi:"metadata"`
    76  	// Untyped map that holds any user-defined fields.
    77  	OtherFields map[string]interface{} `pulumi:""`
    78  }
    79  
    80  // The set of arguments for constructing a CustomResourcePatch resource.
    81  type CustomResourcePatchArgs struct {
    82  	// 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
    83  	ApiVersion pulumi.StringInput
    84  	// 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
    85  	Kind pulumi.StringInput
    86  	// Standard object metadata.
    87  	Metadata metav1.ObjectMetaPtrInput
    88  	// Untyped map that holds any user-defined fields.
    89  	OtherFields kubernetes.UntypedArgs
    90  }
    91  
    92  func (CustomResourcePatchArgs) ElementType() reflect.Type {
    93  	return reflect.TypeOf((*customResourcePatchArgs)(nil)).Elem()
    94  }