Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a ValidateOnly param when creating/updating a deployment #321

Open
kitasuke opened this issue Apr 6, 2021 · 0 comments
Open

Support a ValidateOnly param when creating/updating a deployment #321

kitasuke opened this issue Apr 6, 2021 · 0 comments

Comments

@kitasuke
Copy link

kitasuke commented Apr 6, 2021

Overview

It would be nice to use validate_only query parameter when creating/updating a deployment to just validate the deployment definition. It looks like the elastic client does support the param, but the elastic api doesn't yet.
https://www.elastic.co/guide/en/cloud-enterprise/current/create-deployment.html

Possible Implementation

Add a property for ValidateOnly to CreateParams/UpdateParams struct and pass them when calling CreateDeployment/UpdateDeployment

type UpdateParams struct {
	*api.API

        ...

	// Optional values
	SkipSnapshot      bool
	HidePrunedOrphans bool
	ValidateOnly      bool // Added
}

func Update(params UpdateParams) (*models.DeploymentUpdateResponse, error) {
	...
	
	res, err := params.V1API.Deployments.UpdateDeployment(
		deployments.NewUpdateDeploymentParams().
			WithDeploymentID(params.DeploymentID).
			WithBody(params.Request).
			WithSkipSnapshot(&params.SkipSnapshot).
			WithHidePrunedOrphans(&params.HidePrunedOrphans).
			WithValidateOnly(&params.ValidateOnly), // Added
		params.AuthWriter,
	)

        ...

	return res.Payload, nil
}

Testing

I couldn't find any test code for params, but I'm happy to add a test case

Context

It's always nicer to allow user to validate the deployment definition first before creating/updating a deployment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant