Skip to content

Commit

Permalink
Regenerate client from commit 432578c of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jan 11, 2022
1 parent bfc09fe commit 3716c5c
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 5 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.5.1.dev2",
"regenerated": "2022-01-11 14:01:05.792618",
"spec_repo_commit": "0468fdc"
"regenerated": "2022-01-11 16:59:50.649570",
"spec_repo_commit": "432578c"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2022-01-11 14:01:05.810692",
"spec_repo_commit": "0468fdc"
"regenerated": "2022-01-11 16:59:50.681822",
"spec_repo_commit": "432578c"
}
}
}
22 changes: 22 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12116,6 +12116,11 @@ components:
values:
$ref: '#/components/schemas/UsageAttributionValues'
type: object
UsageAttributionLimit:
default: 5000
description: Maximum number of records to be returned.
format: int64
type: integer
UsageAttributionMetadata:
description: The object containing document metadata.
properties:
Expand All @@ -12124,6 +12129,11 @@ components:
pagination:
$ref: '#/components/schemas/UsageAttributionPagination'
type: object
UsageAttributionOffset:
default: 0
description: Number of records to skip before beginning to return.
format: int64
type: integer
UsageAttributionPagination:
description: The metadata for the current pagination.
properties:
Expand Down Expand Up @@ -24408,6 +24418,18 @@ paths:
schema:
default: false
type: boolean
- description: Number of records to skip before beginning to return.
in: query
name: offset
required: false
schema:
$ref: '#/components/schemas/UsageAttributionOffset'
- description: Maximum number of records to be returned.
in: query
name: limit
required: false
schema:
$ref: '#/components/schemas/UsageAttributionLimit'
responses:
'200':
content:
Expand Down
20 changes: 20 additions & 0 deletions api/v1/datadog/api_usage_metering.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/v1/datadog/docs/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,15 @@ func main() {
sortDirection := datadog.UsageSortDirection("desc") // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
sortName := datadog.UsageAttributionSort("api_percentage") // UsageAttributionSort | The field to sort by. (optional) (default to "custom_timeseries_usage")
includeDescendants := true // bool | Include child org usage in the response. Defaults to false. (optional) (default to false)
offset := int64(789) // int64 | Number of records to skip before beginning to return. (optional) (default to 0)
limit := int64(789) // int64 | Maximum number of records to be returned. (optional) (default to 5000)
optionalParams := datadog.GetUsageAttributionOptionalParameters{
EndMonth: &endMonth,
SortDirection: &sortDirection,
SortName: &sortName,
IncludeDescendants: &includeDescendants,
Offset: &offset,
Limit: &limit,
}

configuration := datadog.NewConfiguration()
Expand Down Expand Up @@ -708,6 +712,8 @@ Other parameters are passed through a pointer to a GetUsageAttributionOptionalPa
| **sortDirection** | [**UsageSortDirection**](UsageSortDirection.md) | The direction to sort by: `[desc, asc]`. | [default to "desc"] |
| **sortName** | [**UsageAttributionSort**](UsageAttributionSort.md) | The field to sort by. | [default to "custom_timeseries_usage"] |
| **includeDescendants** | **bool** | Include child org usage in the response. Defaults to false. | [default to false] |
| **offset** | **int64** | Number of records to skip before beginning to return. | [default to 0] |
| **limit** | **int64** | Maximum number of records to be returned. | [default to 5000] |

### Return type

Expand Down
29 changes: 29 additions & 0 deletions examples/v1/usage-metering/GetUsageAttribution.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Get Usage Attribution returns "OK" response

package main

import (
"context"
"encoding/json"
"fmt"
"os"
"time"

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

func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("GetUsageAttribution", true)
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.UsageMeteringApi.GetUsageAttribution(ctx, time.Now().AddDate(0, 0, -3), datadog.USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, *datadog.NewGetUsageAttributionOptionalParameters().WithOffset(0).WithLimit(1))

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageAttribution`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}

responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageAttribution`:\n%s\n", responseContent)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2022-01-11T15:18:06.776Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
interactions:
- request:
body: ''
form: {}
headers:
Accept:
- application/json;datetime-format=rfc3339
method: GET
url: https://api.datadoghq.com/api/v1/usage/attribution?start_month=2022-01-08T15%3A18%3A06.776Z&fields=%2A&offset=0&limit=1
response:
body: '{"usage":[{"org_name":"DD Integration Tests (321813)","public_id":"fasjyydbcgwwc2uc","tag_config_source":"DD
Integration Tests (321813):::project","tags":{"project":[]},"updated_at":"2022-01-10T14","month":"2022-01-01T00:00:00+00:00","values":{"lambda_percentage":0.0,"apm_host_usage":11,"api_usage":1524624,"dbm_hosts_percentage":0.0,"custom_timeseries_percentage":100.0,"fargate_usage":0.0,"cws_containers_usage":0.0,"profiled_host_percentage":0.0,"cws_hosts_usage":0,"cspm_hosts_percentage":0.0,"cws_hosts_percentage":0.0,"lambda_invocations_percentage":0.0,"infra_host_usage":5,"infra_host_percentage":27.78,"cspm_hosts_usage":0,"container_percentage":100.0,"profiled_host_usage":0,"dbm_queries_usage":0.0,"browser_usage":0,"snmp_percentage":0.0,"profiled_container_usage":0.0,"lambda_functions_usage":0.0,"snmp_usage":0,"api_percentage":100.0,"dbm_hosts_usage":0,"container_usage":1.02,"lambda_usage":0.0,"cspm_containers_usage":0.0,"cspm_containers_percentage":0.0,"npm_host_usage":0,"apm_host_percentage":100.0,"lambda_functions_percentage":0.0,"dbm_queries_percentage":0.0,"profiled_container_percentage":0.0,"npm_host_percentage":0.0,"lambda_invocations_usage":0,"fargate_percentage":0.0,"browser_percentage":0.0,"cws_containers_percentage":0.0,"custom_timeseries_usage":77.08}},{"org_name":"DD
Integration Tests (321813)","public_id":"fasjyydbcgwwc2uc","tag_config_source":"DD
Integration Tests (321813):::project","tags":{"project":["datadog-integrations-lab"]},"updated_at":"2022-01-10T14","month":"2022-01-01T00:00:00+00:00","values":{"lambda_percentage":0.0,"apm_host_usage":0,"api_usage":0,"dbm_hosts_percentage":0.0,"custom_timeseries_percentage":0.0,"fargate_usage":0.0,"cws_containers_usage":0.0,"profiled_host_percentage":0.0,"cws_hosts_usage":0,"cspm_hosts_percentage":0.0,"cws_hosts_percentage":0.0,"lambda_invocations_percentage":0.0,"infra_host_usage":13,"infra_host_percentage":72.22,"cspm_hosts_usage":0,"container_percentage":0.0,"profiled_host_usage":0,"dbm_queries_usage":0.0,"browser_usage":0,"snmp_percentage":0.0,"profiled_container_usage":0.0,"lambda_functions_usage":0.0,"snmp_usage":0,"api_percentage":0.0,"dbm_hosts_usage":0,"container_usage":0.0,"lambda_usage":0.0,"cspm_containers_usage":0.0,"cspm_containers_percentage":0.0,"npm_host_usage":0,"apm_host_percentage":0.0,"lambda_functions_percentage":0.0,"dbm_queries_percentage":0.0,"profiled_container_percentage":0.0,"npm_host_percentage":0.0,"lambda_invocations_usage":0,"fargate_percentage":0.0,"browser_percentage":0.0,"cws_containers_percentage":0.0,"custom_timeseries_usage":0.0}}],"metadata":{"pagination":{"sort_direction":"DESC","sort_name":"custom_timeseries_usage","limit":5000,"total_number_of_records":2,"offset":0},"aggregates":[{"field":"custom_timeseries_usage","value":77.08,"agg_type":"sum"},{"field":"container_usage","value":1.02,"agg_type":"sum"},{"field":"snmp_percentage","value":0.0,"agg_type":"sum"},{"field":"apm_host_usage","value":11.0,"agg_type":"sum"},{"field":"browser_usage","value":0.0,"agg_type":"sum"},{"field":"npm_host_percentage","value":0.0,"agg_type":"sum"},{"field":"infra_host_usage","value":18.0,"agg_type":"sum"},{"field":"custom_timeseries_percentage","value":100.0,"agg_type":"sum"},{"field":"container_percentage","value":100.0,"agg_type":"sum"},{"field":"lambda_usage","value":0.0,"agg_type":"sum"},{"field":"api_usage","value":1524624.0,"agg_type":"sum"},{"field":"apm_host_percentage","value":100.0,"agg_type":"sum"},{"field":"infra_host_percentage","value":100.0,"agg_type":"sum"},{"field":"snmp_usage","value":0.0,"agg_type":"sum"},{"field":"browser_percentage","value":0.0,"agg_type":"sum"},{"field":"api_percentage","value":100.0,"agg_type":"sum"},{"field":"lambda_percentage","value":0.0,"agg_type":"sum"},{"field":"npm_host_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_functions_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_functions_percentage","value":0.0,"agg_type":"sum"},{"field":"lambda_invocations_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_invocations_percentage","value":0.0,"agg_type":"sum"},{"field":"fargate_usage","value":0.0,"agg_type":"sum"},{"field":"fargate_percentage","value":0.0,"agg_type":"sum"},{"field":"profiled_host_usage","value":0.0,"agg_type":"sum"},{"field":"profiled_host_percentage","value":0.0,"agg_type":"sum"},{"field":"profiled_container_usage","value":0.0,"agg_type":"sum"},{"field":"profiled_container_percentage","value":0.0,"agg_type":"sum"},{"field":"cws_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"cws_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"cws_containers_usage","value":0.0,"agg_type":"sum"},{"field":"cws_containers_percentage","value":0.0,"agg_type":"sum"},{"field":"cspm_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"cspm_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"cspm_containers_usage","value":0.0,"agg_type":"sum"},{"field":"cspm_containers_percentage","value":0.0,"agg_type":"sum"},{"field":"dbm_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"dbm_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"dbm_queries_usage","value":0.0,"agg_type":"sum"},{"field":"dbm_queries_percentage","value":0.0,"agg_type":"sum"}]}}'
code: 200
duration: ''
headers:
Content-Type:
- application/json
status: 200 OK
version: 1
6 changes: 5 additions & 1 deletion tests/scenarios/features/v1/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ Feature: Usage Metering
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/red-zone-revenue-query
@team:DataDog/red-zone-revenue-query
Scenario: Get Usage Attribution returns "OK" response
Given operation "GetUsageAttribution" enabled
And new "GetUsageAttribution" request
And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}"
And request contains "fields" parameter with value "*"
And request contains "offset" parameter with value 0
And request contains "limit" parameter with value 1
When the request is sent
Then the response status is 200 OK

Expand Down

0 comments on commit 3716c5c

Please sign in to comment.