elastic / elastic/cloud-sdk-go

Support a ValidateOnly param when creating/updating a deployment

Open
#321 0 comments 0 reactions 0 assignees View on GitHub
Team:Delivery
Dominant language
Go
Stars
23
Forks
52
PR merge metrics
No merged PRs in 30d

Description

## 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(¶ms.SkipSnapshot).
WithHidePrunedOrphans(¶ms.HidePrunedOrphans).
WithValidateOnly(¶ms.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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.