Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17239,6 +17239,89 @@ components:
- started_at
- finished_at
type: object
DORADeploymentPatchRemediation:
description: Remediation details for the deployment.
properties:
id:
description: The ID of the remediation action.
example: eG42zNIkVjM
type: string
type:
$ref: '#/components/schemas/DORADeploymentPatchRemediationType'
required:
- id
- type
type: object
DORADeploymentPatchRemediationType:
description: The type of remediation action taken.
enum:
- rollback
- rollforward
example: rollback
type: string
x-enum-varnames:
- ROLLBACK
- ROLLFORWARD
DORADeploymentPatchRequest:
description: Request to patch a DORA deployment event.
example:
data:
attributes:
change_failure: true
remediation:
id: eG42zNIkVjM
type: rollback
id: z_RwVLi7v4Y
type: dora_deployment_patch_request
properties:
data:
$ref: '#/components/schemas/DORADeploymentPatchRequestData'
required:
- data
type: object
DORADeploymentPatchRequestAttributes:
description: Attributes for patching a DORA deployment event.
properties:
change_failure:
description: Indicates whether the deployment resulted in a change failure.
example: true
type: boolean
remediation:
$ref: '#/components/schemas/DORADeploymentPatchRemediation'
type: object
DORADeploymentPatchRequestData:
description: The JSON:API data for patching a deployment.
example:
attributes:
change_failure: true
remediation:
id: eG42zNIkVjM
type: rollback
id: z_RwVLi7v4Y
type: dora_deployment_patch_request
properties:
attributes:
$ref: '#/components/schemas/DORADeploymentPatchRequestAttributes'
id:
description: The ID of the deployment to patch.
example: z_RwVLi7v4Y
type: string
type:
$ref: '#/components/schemas/DORADeploymentPatchRequestDataType'
required:
- type
- id
- attributes
type: object
DORADeploymentPatchRequestDataType:
default: dora_deployment_patch_request
description: JSON:API type for DORA deployment patch request.
enum:
- dora_deployment_patch_request
example: dora_deployment_patch_request
type: string
x-enum-varnames:
- DORA_DEPLOYMENT_PATCH_REQUEST
DORADeploymentRequest:
description: Request to create a DORA deployment event.
properties:
Expand Down Expand Up @@ -74974,6 +75057,46 @@ paths:
operator: OR
permissions:
- dora_metrics_read
patch:
description: Use this API endpoint to patch a deployment event.
operationId: PatchDORADeployment
parameters:
- description: The ID of the deployment event.
in: path
name: deployment_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DORADeploymentPatchRequest'
required: true
responses:
'202':
description: Accepted
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Bad Request
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Patch a deployment event
tags:
- DORA Metrics
x-codegen-request-body-name: body
x-permission:
operator: OR
permissions:
- dora_metrics_write
/api/v2/dora/failure:
post:
description: 'Use this API endpoint to provide failure data.
Expand Down
80 changes: 80 additions & 0 deletions api/datadogV2/api_dora_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,86 @@ func (a *DORAMetricsApi) ListDORAFailures(ctx _context.Context, body DORAListFai
return localVarReturnValue, localVarHTTPResponse, nil
}

// PatchDORADeployment Patch a deployment event.
// Use this API endpoint to patch a deployment event.
func (a *DORAMetricsApi) PatchDORADeployment(ctx _context.Context, deploymentId string, body DORADeploymentPatchRequest) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DORAMetricsApi.PatchDORADeployment")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/dora/deployments/{deployment_id}"
localVarPath = datadog.ReplacePathParameter(localVarPath, "{deployment_id}", _neturl.PathEscape(datadog.ParameterToString(deploymentId, "")))

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "*/*"

// body params
localVarPostBody = &body
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 {
var v JSONAPIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarHTTPResponse, newErr
}

return localVarHTTPResponse, nil
}

// NewDORAMetricsApi Returns NewDORAMetricsApi.
func NewDORAMetricsApi(client *datadog.APIClient) *DORAMetricsApi {
return &DORAMetricsApi{
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
// - [DORAMetricsApi.GetDORAFailure]
// - [DORAMetricsApi.ListDORADeployments]
// - [DORAMetricsApi.ListDORAFailures]
// - [DORAMetricsApi.PatchDORADeployment]
// - [DashboardListsApi.CreateDashboardListItems]
// - [DashboardListsApi.DeleteDashboardListItems]
// - [DashboardListsApi.GetDashboardListItems]
Expand Down
143 changes: 143 additions & 0 deletions api/datadogV2/model_dora_deployment_patch_remediation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// DORADeploymentPatchRemediation Remediation details for the deployment.
type DORADeploymentPatchRemediation struct {
// The ID of the remediation action.
Id string `json:"id"`
// The type of remediation action taken.
Type DORADeploymentPatchRemediationType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewDORADeploymentPatchRemediation instantiates a new DORADeploymentPatchRemediation object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewDORADeploymentPatchRemediation(id string, typeVar DORADeploymentPatchRemediationType) *DORADeploymentPatchRemediation {
this := DORADeploymentPatchRemediation{}
this.Id = id
this.Type = typeVar
return &this
}

// NewDORADeploymentPatchRemediationWithDefaults instantiates a new DORADeploymentPatchRemediation object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewDORADeploymentPatchRemediationWithDefaults() *DORADeploymentPatchRemediation {
this := DORADeploymentPatchRemediation{}
return &this
}

// GetId returns the Id field value.
func (o *DORADeploymentPatchRemediation) GetId() string {
if o == nil {
var ret string
return ret
}
return o.Id
}

// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *DORADeploymentPatchRemediation) GetIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Id, true
}

// SetId sets field value.
func (o *DORADeploymentPatchRemediation) SetId(v string) {
o.Id = v
}

// GetType returns the Type field value.
func (o *DORADeploymentPatchRemediation) GetType() DORADeploymentPatchRemediationType {
if o == nil {
var ret DORADeploymentPatchRemediationType
return ret
}
return o.Type
}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *DORADeploymentPatchRemediation) GetTypeOk() (*DORADeploymentPatchRemediationType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}

// SetType sets field value.
func (o *DORADeploymentPatchRemediation) SetType(v DORADeploymentPatchRemediationType) {
o.Type = v
}

// MarshalJSON serializes the struct using spec logic.
func (o DORADeploymentPatchRemediation) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["id"] = o.Id
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *DORADeploymentPatchRemediation) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Id *string `json:"id"`
Type *DORADeploymentPatchRemediationType `json:"type"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Id == nil {
return fmt.Errorf("required field id missing")
}
if all.Type == nil {
return fmt.Errorf("required field type missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"})
} else {
return err
}

hasInvalidField := false
o.Id = *all.Id
if !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = *all.Type
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading
Loading