Skip to content

Commit

Permalink
Regenerate client from commit 4c6c51f8 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 9, 2024
1 parent b42950b commit 606df73
Show file tree
Hide file tree
Showing 23 changed files with 2,417 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-09 15:03:02.042923",
"spec_repo_commit": "43ae024c"
"regenerated": "2024-10-09 19:32:22.991209",
"spec_repo_commit": "4c6c51f8"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-09 15:03:02.062476",
"spec_repo_commit": "43ae024c"
"regenerated": "2024-10-09 19:32:23.009906",
"spec_repo_commit": "4c6c51f8"
}
}
}
255 changes: 255 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3951,6 +3951,223 @@ components:
format: int64
type: integer
type: object
ChangeEvent:
description: Object representing a change event.
properties:
aggregation_key:
description: 'An arbitrary string to use for aggregation. Limited to 100
characters.

If you specify a key, all events using that key are grouped together in
the Event Stream.'
maxLength: 100
type: string
attributes:
$ref: '#/components/schemas/ChangeEventCustomAttributes'
category:
$ref: '#/components/schemas/ChangeEventCategory'
message:
description: The body of the event. Limited to 4000 characters.
example: payment_processed feature flag has been enabled
maxLength: 4000
type: string
tags:
description: 'A list of tags to apply to the event.

Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/).'
example:
- environment:test
items:
description: A tag.
type: string
type: array
timestamp:
description: 'Timestamp in which the event occurred. Must follow [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)
format.

For example `"2017-01-15T01:30:15.010000Z"`.

Defaults to now. Limited to values no older than 18 hours.'
type: string
title:
description: The event title. Limited to 500 characters.
example: payment_processed feature flag updated
maxLength: 500
type: string
required:
- title
- category
- attributes
type: object
ChangeEventCategory:
description: Event category to identify the type of event. Only the value `change`
is supported.
enum:
- change
example: change
type: string
x-enum-varnames:
- CHANGE
ChangeEventCreateRequest:
description: Object representing an event.
properties:
attributes:
$ref: '#/components/schemas/ChangeEvent'
type:
$ref: '#/components/schemas/ChangeEventCreateRequestType'
type: object
ChangeEventCreateRequestType:
description: Entity type.
enum:
- event
type: string
x-enum-varnames:
- EVENT
ChangeEventCreateResponse:
description: Object containing an event response.
properties:
attributes:
$ref: '#/components/schemas/ChangeEventCreateResponseAttributes'
type:
description: Event type
type: string
type: object
ChangeEventCreateResponseAttributes:
description: The definition of `ChangeEventCreateResponseAttributes` object.
properties:
attributes:
$ref: '#/components/schemas/ChangeEventCreateResponseAttributesAttributes'
type: object
ChangeEventCreateResponseAttributesAttributes:
description: The definition of `ChangeEventCreateResponseAttributesAttributes`
object.
properties:
evt:
$ref: '#/components/schemas/ChangeEventCreateResponseAttributesAttributesEvt'
type: object
ChangeEventCreateResponseAttributesAttributesEvt:
description: The definition of `ChangeEventCreateResponseAttributesAttributesEvt`
object.
properties:
id:
description: Event id
type: string
type: object
ChangeEventCustomAttributes:
description: Object representing custom event attributes.
properties:
author:
$ref: '#/components/schemas/ChangeEventCustomAttributesAuthor'
change_metadata:
description: Free form object with any related information of the `change`
event.
example:
resource_link: /feature/fallback_payments_test
user:
email: dd_user_email
name: dd_user
type: object
changed_resource:
$ref: '#/components/schemas/ChangeEventCustomAttributesChangedResource'
impacted_resources:
description: 'A list of resources impacted by this change. At least one
resource is required. Only resources

of type `service` are supported.'
example:
- name: payments_api
type: service
items:
$ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItems'
type: array
new_value:
description: Free form object to track new value of the changed resource.
example:
enabled: true
percentage: 50%
rule:
datacenter: us1.prod
type: object
prev_value:
description: Free form object to track previous value of the changed resource.
example:
enabled: true
percentage: 10%
rule:
datacenter: us1.prod
type: object
required:
- changed_resource
type: object
ChangeEventCustomAttributesAuthor:
description: Object representing the entity which made the change. Optional
field but if provided should include `type` and `name`.
properties:
name:
description: Author's name. Limited to 128 characters.
example: ''
maxLength: 128.0
type: string
type:
$ref: '#/components/schemas/ChangeEventCustomAttributesAuthorType'
required:
- name
- type
type: object
ChangeEventCustomAttributesAuthorType:
description: Author's type.
enum:
- user
- system
example: user
type: string
x-enum-varnames:
- USER
- SYSTEM
ChangeEventCustomAttributesChangedResource:
description: Object representing a uniquely identified resource. Only the resource
type `feature_flag` is supported.
properties:
name:
description: Resource's name.
example: fallback_payments_test
type: string
type:
$ref: '#/components/schemas/ChangeEventCustomAttributesChangedResourceType'
required:
- type
- name
type: object
ChangeEventCustomAttributesChangedResourceType:
description: Resource's type.
enum:
- feature_flag
example: feature_flag
type: string
x-enum-varnames:
- FEATURE_FLAG
ChangeEventCustomAttributesImpactedResourcesItems:
description: Object representing a uniquely identified resource. Only the resource
type `service` is supported.
properties:
name:
description: Resource's name.
example: payments_api
type: string
type:
$ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItemsType'
required:
- type
- name
type: object
ChangeEventCustomAttributesImpactedResourcesItemsType:
description: Resource's type.
enum:
- service
example: service
type: string
x-enum-varnames:
- SERVICE
ChargebackBreakdown:
description: Charges breakdown.
properties:
Expand Down Expand Up @@ -29664,6 +29881,44 @@ paths:
operator: OR
permissions:
- events_read
post:
description: This endpoint allows you to post events. Only events with `change`
category are supported.
operationId: CreateEvent
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEventCreateRequest'
description: Event request object
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEventCreateResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Bad request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Forbidden
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
summary: Post a change event
tags:
- Events
x-codegen-request-body-name: body
/api/v2/events/search:
post:
description: 'List endpoint returns events that match an events search query.
Expand Down
81 changes: 81 additions & 0 deletions api/datadogV2/api_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,87 @@ import (
// EventsApi service type
type EventsApi datadog.Service

// CreateEvent Post a change event.
// This endpoint allows you to post events. Only events with `change` category are supported.
func (a *EventsApi) CreateEvent(ctx _context.Context, body ChangeEventCreateRequest) (ChangeEventCreateResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarReturnValue ChangeEventCreateResponse
)

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

localVarPath := localBasePath + "/api/v2/events"

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

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

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

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

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

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// ListEventsOptionalParameters holds optional parameters for ListEvents.
type ListEventsOptionalParameters struct {
FilterQuery *string
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
// - [DowntimesApi.ListDowntimes]
// - [DowntimesApi.ListMonitorDowntimes]
// - [DowntimesApi.UpdateDowntime]
// - [EventsApi.CreateEvent]
// - [EventsApi.ListEvents]
// - [EventsApi.SearchEvents]
// - [FastlyIntegrationApi.CreateFastlyAccount]
Expand Down
Loading

0 comments on commit 606df73

Please sign in to comment.