| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package v1beta1 |
| 20 |
|
| 21 |
import ( |
| 22 |
context "context" |
| 23 |
fmt "fmt" |
| 24 |
|
| 25 |
extensionsv1beta1 "k8s.io/api/extensions/v1beta1" |
| 26 |
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 27 |
types "k8s.io/apimachinery/pkg/types" |
| 28 |
watch "k8s.io/apimachinery/pkg/watch" |
| 29 |
applyconfigurationsextensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1" |
| 30 |
gentype "k8s.io/client-go/gentype" |
| 31 |
scheme "k8s.io/client-go/kubernetes/scheme" |
| 32 |
apply "k8s.io/client-go/util/apply" |
| 33 |
) |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
type DeploymentsGetter interface { |
| 38 |
Deployments(namespace string) DeploymentInterface |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
type DeploymentInterface interface { |
| 43 |
Create(ctx context.Context, deployment *extensionsv1beta1.Deployment, opts v1.CreateOptions) (*extensionsv1beta1.Deployment, error) |
| 44 |
Update(ctx context.Context, deployment *extensionsv1beta1.Deployment, opts v1.UpdateOptions) (*extensionsv1beta1.Deployment, error) |
| 45 |
|
| 46 |
UpdateStatus(ctx context.Context, deployment *extensionsv1beta1.Deployment, opts v1.UpdateOptions) (*extensionsv1beta1.Deployment, error) |
| 47 |
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error |
| 48 |
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error |
| 49 |
Get(ctx context.Context, name string, opts v1.GetOptions) (*extensionsv1beta1.Deployment, error) |
| 50 |
List(ctx context.Context, opts v1.ListOptions) (*extensionsv1beta1.DeploymentList, error) |
| 51 |
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) |
| 52 |
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *extensionsv1beta1.Deployment, err error) |
| 53 |
Apply(ctx context.Context, deployment *applyconfigurationsextensionsv1beta1.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *extensionsv1beta1.Deployment, err error) |
| 54 |
|
| 55 |
ApplyStatus(ctx context.Context, deployment *applyconfigurationsextensionsv1beta1.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *extensionsv1beta1.Deployment, err error) |
| 56 |
GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (*extensionsv1beta1.Scale, error) |
| 57 |
UpdateScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.Scale, opts v1.UpdateOptions) (*extensionsv1beta1.Scale, error) |
| 58 |
ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsextensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (*extensionsv1beta1.Scale, error) |
| 59 |
|
| 60 |
DeploymentExpansion |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
type deployments struct { |
| 65 |
*gentype.ClientWithListAndApply[*extensionsv1beta1.Deployment, *extensionsv1beta1.DeploymentList, *applyconfigurationsextensionsv1beta1.DeploymentApplyConfiguration] |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
func newDeployments(c *ExtensionsV1beta1Client, namespace string) *deployments { |
| 70 |
return &deployments{ |
| 71 |
gentype.NewClientWithListAndApply[*extensionsv1beta1.Deployment, *extensionsv1beta1.DeploymentList, *applyconfigurationsextensionsv1beta1.DeploymentApplyConfiguration]( |
| 72 |
"deployments", |
| 73 |
c.RESTClient(), |
| 74 |
scheme.ParameterCodec, |
| 75 |
namespace, |
| 76 |
func() *extensionsv1beta1.Deployment { return &extensionsv1beta1.Deployment{} }, |
| 77 |
func() *extensionsv1beta1.DeploymentList { return &extensionsv1beta1.DeploymentList{} }, |
| 78 |
gentype.PrefersProtobuf[*extensionsv1beta1.Deployment](), |
| 79 |
), |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
func (c *deployments) GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (result *extensionsv1beta1.Scale, err error) { |
| 85 |
result = &extensionsv1beta1.Scale{} |
| 86 |
err = c.GetClient().Get(). |
| 87 |
UseProtobufAsDefault(). |
| 88 |
Namespace(c.GetNamespace()). |
| 89 |
Resource("deployments"). |
| 90 |
Name(deploymentName). |
| 91 |
SubResource("scale"). |
| 92 |
VersionedParams(&options, scheme.ParameterCodec). |
| 93 |
Do(ctx). |
| 94 |
Into(result) |
| 95 |
return |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.Scale, opts v1.UpdateOptions) (result *extensionsv1beta1.Scale, err error) { |
| 100 |
result = &extensionsv1beta1.Scale{} |
| 101 |
err = c.GetClient().Put(). |
| 102 |
UseProtobufAsDefault(). |
| 103 |
Namespace(c.GetNamespace()). |
| 104 |
Resource("deployments"). |
| 105 |
Name(deploymentName). |
| 106 |
SubResource("scale"). |
| 107 |
VersionedParams(&opts, scheme.ParameterCodec). |
| 108 |
Body(scale). |
| 109 |
Do(ctx). |
| 110 |
Into(result) |
| 111 |
return |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsextensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *extensionsv1beta1.Scale, err error) { |
| 117 |
if scale == nil { |
| 118 |
return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") |
| 119 |
} |
| 120 |
patchOpts := opts.ToPatchOptions() |
| 121 |
request, err := apply.NewRequest(c.GetClient(), scale) |
| 122 |
if err != nil { |
| 123 |
return nil, err |
| 124 |
} |
| 125 |
|
| 126 |
result = &extensionsv1beta1.Scale{} |
| 127 |
err = request. |
| 128 |
UseProtobufAsDefault(). |
| 129 |
Namespace(c.GetNamespace()). |
| 130 |
Resource("deployments"). |
| 131 |
Name(deploymentName). |
| 132 |
SubResource("scale"). |
| 133 |
VersionedParams(&patchOpts, scheme.ParameterCodec). |
| 134 |
Do(ctx). |
| 135 |
Into(result) |
| 136 |
return |
| 137 |
} |