Skip to content

Commit

Permalink
Regenerate client from commit 4569968f of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 10, 2022
1 parent ab05f5a commit 071519e
Show file tree
Hide file tree
Showing 12 changed files with 1,232 additions and 4 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.2",
"regenerated": "2022-06-09 11:12:46.854122",
"spec_repo_commit": "b9e36dc8"
"regenerated": "2022-06-10 17:54:55.776570",
"spec_repo_commit": "4569968f"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-06-09 11:12:46.864763",
"spec_repo_commit": "b9e36dc8"
"regenerated": "2022-06-10 17:54:55.788684",
"spec_repo_commit": "4569968f"
}
}
}
158 changes: 158 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,96 @@ components:
type: integer
readOnly: true
type: object
DistributionPoint:
description: Array of distribution points.
example:
- 1575317847.0
- - 0.5
- 1.0
items:
description: List of distribution point.
oneOf:
- $ref: '#/components/schemas/DistributionPointTimestamp'
- $ref: '#/components/schemas/DistributionPointData'
maxItems: 2
minItems: 2
type: array
DistributionPointData:
description: Distribution point data.
items:
description: List of distribution point data.
format: double
type: number
type: array
DistributionPointTimestamp:
description: Distribution point timestamp. It should be in seconds and current.
format: double
type: number
DistributionPointsContentEncoding:
description: HTTP header used to compress the media-type.
enum:
- deflate
type: string
x-enum-varnames:
- DEFLATE
DistributionPointsPayload:
description: The distribution points payload.
properties:
series:
description: A list of distribution points series to submit to Datadog.
example:
- metric: system.load.1
points:
- - 1475317847.0
- - 1.0
- 2.0
items:
$ref: '#/components/schemas/DistributionPointsSeries'
type: array
required:
- series
type: object
DistributionPointsSeries:
description: A distribution points metric to submit to Datadog.
properties:
host:
description: The name of the host that produced the distribution point metric.
example: test.example.com
type: string
metric:
description: The name of the distribution points metric.
example: system.load.1
type: string
points:
description: Points relating to the distribution point metric. All points
must be tuples with timestamp and a list of values (cannot be a string).
Timestamps should be in POSIX time in seconds.
items:
$ref: '#/components/schemas/DistributionPoint'
type: array
tags:
description: A list of tags associated with the distribution point metric.
example:
- environment:test
items:
description: Individual tags.
type: string
type: array
type:
$ref: '#/components/schemas/DistributionPointsType'
required:
- metric
- points
type: object
DistributionPointsType:
default: distribution
description: The type of the distribution point.
enum:
- distribution
example: distribution
type: string
x-enum-varnames:
- DISTRIBUTION
DistributionWidgetDefinition:
description: "The Distribution visualization is another way of showing metrics\naggregated
across one or several tags, such as hosts.\nUnlike the heat map, a distribution
Expand Down Expand Up @@ -18016,6 +18106,74 @@ paths:
x-menu-order: 6
x-undo:
type: idempotent
/api/v1/distribution_points:
post:
description: "The distribution points end-point allows you to post distribution
data that can be graphed on Datadog\u2019s dashboards."
operationId: SubmitDistributionPoints
parameters:
- description: HTTP header used to compress the media-type.
in: header
name: Content-Encoding
required: false
schema:
$ref: '#/components/schemas/DistributionPointsContentEncoding'
requestBody:
content:
text/json:
examples:
dynamic-points:
description: "Post time-series data that can be graphed on Datadog\u2019s
dashboards."
externalValue: examples/metrics/distribution-points.json.sh
summary: Dynamic Points
x-variables:
NOW: $(date +%s)
schema:
$ref: '#/components/schemas/DistributionPointsPayload'
required: true
responses:
'202':
content:
text/json:
schema:
$ref: '#/components/schemas/IntakePayloadAccepted'
description: Payload accepted
'400':
content:
text/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
text/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Authentication error
'408':
content:
text/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Request timeout
'413':
content:
text/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Payload too large
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
summary: Submit distribution points
tags:
- Metrics
x-codegen-request-body-name: body
x-menu-order: 1
x-undo:
type: safe
/api/v1/downtime:
get:
description: Get all scheduled downtimes.
Expand Down
199 changes: 199 additions & 0 deletions api/v1/datadog/api_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,205 @@ func (a *MetricsApiService) queryMetricsExecute(r apiQueryMetricsRequest) (Metri
return localVarReturnValue, localVarHTTPResponse, nil
}

type apiSubmitDistributionPointsRequest struct {
ctx _context.Context
ApiService *MetricsApiService
body *DistributionPointsPayload
contentEncoding *DistributionPointsContentEncoding
}

// SubmitDistributionPointsOptionalParameters holds optional parameters for SubmitDistributionPoints.
type SubmitDistributionPointsOptionalParameters struct {
ContentEncoding *DistributionPointsContentEncoding
}

// NewSubmitDistributionPointsOptionalParameters creates an empty struct for parameters.
func NewSubmitDistributionPointsOptionalParameters() *SubmitDistributionPointsOptionalParameters {
this := SubmitDistributionPointsOptionalParameters{}
return &this
}

// WithContentEncoding sets the corresponding parameter name and returns the struct.
func (r *SubmitDistributionPointsOptionalParameters) WithContentEncoding(contentEncoding DistributionPointsContentEncoding) *SubmitDistributionPointsOptionalParameters {
r.ContentEncoding = &contentEncoding
return r
}

func (a *MetricsApiService) buildSubmitDistributionPointsRequest(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (apiSubmitDistributionPointsRequest, error) {
req := apiSubmitDistributionPointsRequest{
ApiService: a,
ctx: ctx,
body: &body,
}

if len(o) > 1 {
return req, reportError("only one argument of type SubmitDistributionPointsOptionalParameters is allowed")
}

if o != nil {
req.contentEncoding = o[0].ContentEncoding
}
return req, nil
}

// SubmitDistributionPoints Submit distribution points.
// The distribution points end-point allows you to post distribution data that can be graphed on Datadog’s dashboards.
func (a *MetricsApiService) SubmitDistributionPoints(ctx _context.Context, body DistributionPointsPayload, o ...SubmitDistributionPointsOptionalParameters) (IntakePayloadAccepted, *_nethttp.Response, error) {
req, err := a.buildSubmitDistributionPointsRequest(ctx, body, o...)
if err != nil {
var localVarReturnValue IntakePayloadAccepted
return localVarReturnValue, nil, err
}

return req.ApiService.submitDistributionPointsExecute(req)
}

// submitDistributionPointsExecute executes the request.
func (a *MetricsApiService) submitDistributionPointsExecute(r apiSubmitDistributionPointsRequest) (IntakePayloadAccepted, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarReturnValue IntakePayloadAccepted
)

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetricsApiService.SubmitDistributionPoints")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}

localVarPath := localBasePath + "/api/v1/distribution_points"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return localVarReturnValue, nil, reportError("body is required and must be specified")
}

// to determine the Content-Type header
localVarHTTPContentTypes := []string{"text/json"}

// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}

// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"text/json", "application/json"}

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}

if r.contentEncoding != nil {
localVarHeaderParams["Content-Encoding"] = parameterToString(*r.contentEncoding, "")
}

// body params
localVarPostBody = r.body
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["apiKeyAuth"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["DD-API-KEY"] = key
}
}
}
req, err := a.client.PrepareRequest(r.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 := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 403 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 408 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 413 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = 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 {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

type apiSubmitMetricsRequest struct {
ctx _context.Context
ApiService *MetricsApiService
Expand Down
Loading

0 comments on commit 071519e

Please sign in to comment.