github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/core/v1/servicePatch.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  // Patch resources are used to modify existing Kubernetes resources by using
    15  // Server-Side Apply updates. The name of the resource must be specified, but all other properties are optional. More than
    16  // one patch may be applied to the same resource, and a random FieldManager name will be used for each Patch resource.
    17  // Conflicts will result in an error by default, but can be forced using the "pulumi.com/patchForce" annotation. See the
    18  // [Server-Side Apply Docs](https://www.pulumi.com/registry/packages/kubernetes/how-to-guides/managing-resources-with-server-side-apply/) for
    19  // additional information about using Server-Side Apply to manage Kubernetes resources with Pulumi.
    20  // Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.
    21  //
    22  // This resource waits until its status is ready before registering success
    23  // for create/update, and populating output properties from the current state of the resource.
    24  // The following conditions are used to determine whether the resource creation has
    25  // succeeded or failed:
    26  //
    27  //  1. Service object exists.
    28  //  2. Related Endpoint objects are created. Each time we get an update, wait 10 seconds
    29  //     for any stragglers.
    30  //  3. The endpoints objects target some number of living objects (unless the Service is
    31  //     an "empty headless" Service [1] or a Service with '.spec.type: ExternalName').
    32  //  4. External IP address is allocated (if Service has '.spec.type: LoadBalancer').
    33  //
    34  // Known limitations:
    35  // Services targeting ReplicaSets (and, by extension, Deployments,
    36  // StatefulSets, etc.) with '.spec.replicas' set to 0 are not handled, and will time
    37  // out. To work around this limitation, set 'pulumi.com/skipAwait: "true"' on
    38  // '.metadata.annotations' for the Service. Work to handle this case is in progress [2].
    39  //
    40  // [1] https://kubernetes.io/docs/concepts/services-networking/service/#headless-services
    41  // [2] https://github.com/pulumi/pulumi-kubernetes/pull/703
    42  //
    43  // If the Service has not reached a Ready state after 10 minutes, it will
    44  // time out and mark the resource update as Failed. You can override the default timeout value
    45  // by setting the 'customTimeouts' option on the resource.
    46  type ServicePatch struct {
    47  	pulumi.CustomResourceState
    48  
    49  	// 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
    50  	ApiVersion pulumi.StringPtrOutput `pulumi:"apiVersion"`
    51  	// 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
    52  	Kind pulumi.StringPtrOutput `pulumi:"kind"`
    53  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    54  	Metadata metav1.ObjectMetaPatchPtrOutput `pulumi:"metadata"`
    55  	// Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    56  	Spec ServiceSpecPatchPtrOutput `pulumi:"spec"`
    57  	// Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
    58  	Status ServiceStatusPatchPtrOutput `pulumi:"status"`
    59  }
    60  
    61  // NewServicePatch registers a new resource with the given unique name, arguments, and options.
    62  func NewServicePatch(ctx *pulumi.Context,
    63  	name string, args *ServicePatchArgs, opts ...pulumi.ResourceOption) (*ServicePatch, error) {
    64  	if args == nil {
    65  		args = &ServicePatchArgs{}
    66  	}
    67  
    68  	args.ApiVersion = pulumi.StringPtr("v1")
    69  	args.Kind = pulumi.StringPtr("Service")
    70  	var resource ServicePatch
    71  	err := ctx.RegisterResource("kubernetes:core/v1:ServicePatch", name, args, &resource, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return &resource, nil
    76  }
    77  
    78  // GetServicePatch gets an existing ServicePatch resource's state with the given name, ID, and optional
    79  // state properties that are used to uniquely qualify the lookup (nil if not required).
    80  func GetServicePatch(ctx *pulumi.Context,
    81  	name string, id pulumi.IDInput, state *ServicePatchState, opts ...pulumi.ResourceOption) (*ServicePatch, error) {
    82  	var resource ServicePatch
    83  	err := ctx.ReadResource("kubernetes:core/v1:ServicePatch", name, id, state, &resource, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return &resource, nil
    88  }
    89  
    90  // Input properties used for looking up and filtering ServicePatch resources.
    91  type servicePatchState struct {
    92  }
    93  
    94  type ServicePatchState struct {
    95  }
    96  
    97  func (ServicePatchState) ElementType() reflect.Type {
    98  	return reflect.TypeOf((*servicePatchState)(nil)).Elem()
    99  }
   100  
   101  type servicePatchArgs struct {
   102  	// 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
   103  	ApiVersion *string `pulumi:"apiVersion"`
   104  	// 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
   105  	Kind *string `pulumi:"kind"`
   106  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   107  	Metadata *metav1.ObjectMetaPatch `pulumi:"metadata"`
   108  	// Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   109  	Spec *ServiceSpecPatch `pulumi:"spec"`
   110  }
   111  
   112  // The set of arguments for constructing a ServicePatch resource.
   113  type ServicePatchArgs struct {
   114  	// 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
   115  	ApiVersion pulumi.StringPtrInput
   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's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   119  	Metadata metav1.ObjectMetaPatchPtrInput
   120  	// Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   121  	Spec ServiceSpecPatchPtrInput
   122  }
   123  
   124  func (ServicePatchArgs) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*servicePatchArgs)(nil)).Elem()
   126  }
   127  
   128  type ServicePatchInput interface {
   129  	pulumi.Input
   130  
   131  	ToServicePatchOutput() ServicePatchOutput
   132  	ToServicePatchOutputWithContext(ctx context.Context) ServicePatchOutput
   133  }
   134  
   135  func (*ServicePatch) ElementType() reflect.Type {
   136  	return reflect.TypeOf((**ServicePatch)(nil)).Elem()
   137  }
   138  
   139  func (i *ServicePatch) ToServicePatchOutput() ServicePatchOutput {
   140  	return i.ToServicePatchOutputWithContext(context.Background())
   141  }
   142  
   143  func (i *ServicePatch) ToServicePatchOutputWithContext(ctx context.Context) ServicePatchOutput {
   144  	return pulumi.ToOutputWithContext(ctx, i).(ServicePatchOutput)
   145  }
   146  
   147  // ServicePatchArrayInput is an input type that accepts ServicePatchArray and ServicePatchArrayOutput values.
   148  // You can construct a concrete instance of `ServicePatchArrayInput` via:
   149  //
   150  //	ServicePatchArray{ ServicePatchArgs{...} }
   151  type ServicePatchArrayInput interface {
   152  	pulumi.Input
   153  
   154  	ToServicePatchArrayOutput() ServicePatchArrayOutput
   155  	ToServicePatchArrayOutputWithContext(context.Context) ServicePatchArrayOutput
   156  }
   157  
   158  type ServicePatchArray []ServicePatchInput
   159  
   160  func (ServicePatchArray) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*[]*ServicePatch)(nil)).Elem()
   162  }
   163  
   164  func (i ServicePatchArray) ToServicePatchArrayOutput() ServicePatchArrayOutput {
   165  	return i.ToServicePatchArrayOutputWithContext(context.Background())
   166  }
   167  
   168  func (i ServicePatchArray) ToServicePatchArrayOutputWithContext(ctx context.Context) ServicePatchArrayOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(ServicePatchArrayOutput)
   170  }
   171  
   172  // ServicePatchMapInput is an input type that accepts ServicePatchMap and ServicePatchMapOutput values.
   173  // You can construct a concrete instance of `ServicePatchMapInput` via:
   174  //
   175  //	ServicePatchMap{ "key": ServicePatchArgs{...} }
   176  type ServicePatchMapInput interface {
   177  	pulumi.Input
   178  
   179  	ToServicePatchMapOutput() ServicePatchMapOutput
   180  	ToServicePatchMapOutputWithContext(context.Context) ServicePatchMapOutput
   181  }
   182  
   183  type ServicePatchMap map[string]ServicePatchInput
   184  
   185  func (ServicePatchMap) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*map[string]*ServicePatch)(nil)).Elem()
   187  }
   188  
   189  func (i ServicePatchMap) ToServicePatchMapOutput() ServicePatchMapOutput {
   190  	return i.ToServicePatchMapOutputWithContext(context.Background())
   191  }
   192  
   193  func (i ServicePatchMap) ToServicePatchMapOutputWithContext(ctx context.Context) ServicePatchMapOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(ServicePatchMapOutput)
   195  }
   196  
   197  type ServicePatchOutput struct{ *pulumi.OutputState }
   198  
   199  func (ServicePatchOutput) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**ServicePatch)(nil)).Elem()
   201  }
   202  
   203  func (o ServicePatchOutput) ToServicePatchOutput() ServicePatchOutput {
   204  	return o
   205  }
   206  
   207  func (o ServicePatchOutput) ToServicePatchOutputWithContext(ctx context.Context) ServicePatchOutput {
   208  	return o
   209  }
   210  
   211  // 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
   212  func (o ServicePatchOutput) ApiVersion() pulumi.StringPtrOutput {
   213  	return o.ApplyT(func(v *ServicePatch) pulumi.StringPtrOutput { return v.ApiVersion }).(pulumi.StringPtrOutput)
   214  }
   215  
   216  // 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
   217  func (o ServicePatchOutput) Kind() pulumi.StringPtrOutput {
   218  	return o.ApplyT(func(v *ServicePatch) pulumi.StringPtrOutput { return v.Kind }).(pulumi.StringPtrOutput)
   219  }
   220  
   221  // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   222  func (o ServicePatchOutput) Metadata() metav1.ObjectMetaPatchPtrOutput {
   223  	return o.ApplyT(func(v *ServicePatch) metav1.ObjectMetaPatchPtrOutput { return v.Metadata }).(metav1.ObjectMetaPatchPtrOutput)
   224  }
   225  
   226  // Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   227  func (o ServicePatchOutput) Spec() ServiceSpecPatchPtrOutput {
   228  	return o.ApplyT(func(v *ServicePatch) ServiceSpecPatchPtrOutput { return v.Spec }).(ServiceSpecPatchPtrOutput)
   229  }
   230  
   231  // Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   232  func (o ServicePatchOutput) Status() ServiceStatusPatchPtrOutput {
   233  	return o.ApplyT(func(v *ServicePatch) ServiceStatusPatchPtrOutput { return v.Status }).(ServiceStatusPatchPtrOutput)
   234  }
   235  
   236  type ServicePatchArrayOutput struct{ *pulumi.OutputState }
   237  
   238  func (ServicePatchArrayOutput) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*[]*ServicePatch)(nil)).Elem()
   240  }
   241  
   242  func (o ServicePatchArrayOutput) ToServicePatchArrayOutput() ServicePatchArrayOutput {
   243  	return o
   244  }
   245  
   246  func (o ServicePatchArrayOutput) ToServicePatchArrayOutputWithContext(ctx context.Context) ServicePatchArrayOutput {
   247  	return o
   248  }
   249  
   250  func (o ServicePatchArrayOutput) Index(i pulumi.IntInput) ServicePatchOutput {
   251  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServicePatch {
   252  		return vs[0].([]*ServicePatch)[vs[1].(int)]
   253  	}).(ServicePatchOutput)
   254  }
   255  
   256  type ServicePatchMapOutput struct{ *pulumi.OutputState }
   257  
   258  func (ServicePatchMapOutput) ElementType() reflect.Type {
   259  	return reflect.TypeOf((*map[string]*ServicePatch)(nil)).Elem()
   260  }
   261  
   262  func (o ServicePatchMapOutput) ToServicePatchMapOutput() ServicePatchMapOutput {
   263  	return o
   264  }
   265  
   266  func (o ServicePatchMapOutput) ToServicePatchMapOutputWithContext(ctx context.Context) ServicePatchMapOutput {
   267  	return o
   268  }
   269  
   270  func (o ServicePatchMapOutput) MapIndex(k pulumi.StringInput) ServicePatchOutput {
   271  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServicePatch {
   272  		return vs[0].(map[string]*ServicePatch)[vs[1].(string)]
   273  	}).(ServicePatchOutput)
   274  }
   275  
   276  func init() {
   277  	pulumi.RegisterInputType(reflect.TypeOf((*ServicePatchInput)(nil)).Elem(), &ServicePatch{})
   278  	pulumi.RegisterInputType(reflect.TypeOf((*ServicePatchArrayInput)(nil)).Elem(), ServicePatchArray{})
   279  	pulumi.RegisterInputType(reflect.TypeOf((*ServicePatchMapInput)(nil)).Elem(), ServicePatchMap{})
   280  	pulumi.RegisterOutputType(ServicePatchOutput{})
   281  	pulumi.RegisterOutputType(ServicePatchArrayOutput{})
   282  	pulumi.RegisterOutputType(ServicePatchMapOutput{})
   283  }