// Restart a Deployment rollout.
Restart a Deployment rollout.
// Restart a Deployment rollout .
func (d *Deployment) Restart(ctx context.Context, path string) error {
	dp, err := d.Load(d.Factory, path)
	if err != nil {
		return err
	}
	ns, _ := client.Namespaced(path)
	auth, err := d.Client().CanI(ns, "apps/v1/deployments", []string{client.PatchVerb})
	if err != nil {
		return err
	}
	if !auth {
		return fmt.Errorf("user is not authorized to restart a deployment")
	}
	update, err := polymorphichelpers.ObjectRestarterFn(dp)
	if err != nil {
		return err
	}
	dial, err := d.Client().Dial()
	if err != nil {
		return err
	}
	_, err = dial.AppsV1().Deployments(dp.Namespace).Patch(
		ctx,
		dp.Name,
		types.StrategicMergePatchType,
		update,
		metav1.PatchOptions{},
	)
	return err
}
func ( d * Deployment ) Restart ( ctx context . Context , path string ) error { dp , err := d . Load ( d . Factory , path ) if err != nil { return err } ns , _ := client . Namespaced ( path ) auth , err := d . Client ( ) . CanI ( ns , " " , [ ] string { client . PatchVerb } ) if err != nil { return err } if ! auth { return fmt . Errorf ( " " ) } update , err := polymorphichelpers . ObjectRestarterFn ( dp ) if err != nil { return err } dial , err := d . Client ( ) . Dial ( ) if err != nil { return err } _ , err = dial . AppsV1 ( ) . Deployments ( dp . Namespace ) . Patch ( ctx , dp . Name , types . StrategicMergePatchType , update , metav1 . PatchOptions { } , ) return err }
Restart a Deployment rollout.
Restart a Deployment rollout .