Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grpc subtype to synthetics tests #1486

Merged
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
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-05-24 10:04:34.685843",
"spec_repo_commit": "068bc4e7"
"regenerated": "2022-05-24 12:50:09.703131",
"spec_repo_commit": "84372280"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-05-24 10:04:34.698352",
"spec_repo_commit": "068bc4e7"
"regenerated": "2022-05-24 12:50:09.723122",
"spec_repo_commit": "84372280"
}
}
}
17 changes: 16 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10453,6 +10453,7 @@ components:
- packetsReceived
- networkHop
- receivedMessage
- grpcHealthcheckStatus
- connection
example: statusCode
type: string
Expand All @@ -10472,6 +10473,7 @@ components:
- PACKETS_RECEIVED
- NETWORK_HOP
- RECEIVED_MESSAGE
- GRPC_HEALTHCHECK_STATUS
- CONNECTION
SyntheticsBasicAuth:
description: Object to handle basic authentication when performing the test.
Expand Down Expand Up @@ -11976,7 +11978,7 @@ components:
SyntheticsTestDetailsSubType:
description: 'The subtype of the Synthetic API test, `http`, `ssl`, `tcp`,

`dns`, `icmp`, `udp`, `websocket` or `multi`.'
`dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`.'
enum:
- http
- ssl
Expand All @@ -11986,6 +11988,7 @@ components:
- icmp
- udp
- websocket
- grpc
example: http
type: string
x-enum-varnames:
Expand All @@ -11997,6 +12000,7 @@ components:
- ICMP
- UDP
- WEBSOCKET
- GRPC
SyntheticsTestDetailsType:
description: Type of the Synthetic test, either `api` or `browser`.
enum:
Expand All @@ -12023,6 +12027,12 @@ components:
type: string
description: Headers to include when performing the test.
type: object
SyntheticsTestMetadata:
additionalProperties:
description: A single Metadatum.
type: string
description: Metadata to include when performing the gRPC test.
type: object
SyntheticsTestMonitorStatus:
description: 'The status of your Synthetic monitor.

Expand Down Expand Up @@ -12200,6 +12210,8 @@ components:
message:
description: Message to send for UDP or WebSocket tests.
type: string
metadata:
$ref: '#/components/schemas/SyntheticsTestMetadata'
method:
$ref: '#/components/schemas/HTTPMethod'
noSavingResponseBody:
Expand Down Expand Up @@ -12228,6 +12240,9 @@ components:

the same IP address and TCP port number.'
type: string
service:
description: gRPC service on which you want to perform the healthcheck.
type: string
shouldTrackHops:
description: Turns on a traceroute probe to discover all gateways along
the path to the host destination.
Expand Down
2 changes: 1 addition & 1 deletion api/v1/datadog/model_synthetics_api_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type SyntheticsAPITest struct {
// Synthetic test.
Status *SyntheticsTestPauseStatus `json:"status,omitempty"`
// The subtype of the Synthetic API test, `http`, `ssl`, `tcp`,
// `dns`, `icmp`, `udp`, `websocket` or `multi`.
// `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`.
Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"`
// Array of tags attached to the test.
Tags []string `json:"tags,omitempty"`
Expand Down
34 changes: 18 additions & 16 deletions api/v1/datadog/model_synthetics_assertion_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ type SyntheticsAssertionType string

// List of SyntheticsAssertionType.
const (
SYNTHETICSASSERTIONTYPE_BODY SyntheticsAssertionType = "body"
SYNTHETICSASSERTIONTYPE_HEADER SyntheticsAssertionType = "header"
SYNTHETICSASSERTIONTYPE_STATUS_CODE SyntheticsAssertionType = "statusCode"
SYNTHETICSASSERTIONTYPE_CERTIFICATE SyntheticsAssertionType = "certificate"
SYNTHETICSASSERTIONTYPE_RESPONSE_TIME SyntheticsAssertionType = "responseTime"
SYNTHETICSASSERTIONTYPE_PROPERTY SyntheticsAssertionType = "property"
SYNTHETICSASSERTIONTYPE_RECORD_EVERY SyntheticsAssertionType = "recordEvery"
SYNTHETICSASSERTIONTYPE_RECORD_SOME SyntheticsAssertionType = "recordSome"
SYNTHETICSASSERTIONTYPE_TLS_VERSION SyntheticsAssertionType = "tlsVersion"
SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION SyntheticsAssertionType = "minTlsVersion"
SYNTHETICSASSERTIONTYPE_LATENCY SyntheticsAssertionType = "latency"
SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE SyntheticsAssertionType = "packetLossPercentage"
SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED SyntheticsAssertionType = "packetsReceived"
SYNTHETICSASSERTIONTYPE_NETWORK_HOP SyntheticsAssertionType = "networkHop"
SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE SyntheticsAssertionType = "receivedMessage"
SYNTHETICSASSERTIONTYPE_CONNECTION SyntheticsAssertionType = "connection"
SYNTHETICSASSERTIONTYPE_BODY SyntheticsAssertionType = "body"
SYNTHETICSASSERTIONTYPE_HEADER SyntheticsAssertionType = "header"
SYNTHETICSASSERTIONTYPE_STATUS_CODE SyntheticsAssertionType = "statusCode"
SYNTHETICSASSERTIONTYPE_CERTIFICATE SyntheticsAssertionType = "certificate"
SYNTHETICSASSERTIONTYPE_RESPONSE_TIME SyntheticsAssertionType = "responseTime"
SYNTHETICSASSERTIONTYPE_PROPERTY SyntheticsAssertionType = "property"
SYNTHETICSASSERTIONTYPE_RECORD_EVERY SyntheticsAssertionType = "recordEvery"
SYNTHETICSASSERTIONTYPE_RECORD_SOME SyntheticsAssertionType = "recordSome"
SYNTHETICSASSERTIONTYPE_TLS_VERSION SyntheticsAssertionType = "tlsVersion"
SYNTHETICSASSERTIONTYPE_MIN_TLS_VERSION SyntheticsAssertionType = "minTlsVersion"
SYNTHETICSASSERTIONTYPE_LATENCY SyntheticsAssertionType = "latency"
SYNTHETICSASSERTIONTYPE_PACKET_LOSS_PERCENTAGE SyntheticsAssertionType = "packetLossPercentage"
SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED SyntheticsAssertionType = "packetsReceived"
SYNTHETICSASSERTIONTYPE_NETWORK_HOP SyntheticsAssertionType = "networkHop"
SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE SyntheticsAssertionType = "receivedMessage"
SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS SyntheticsAssertionType = "grpcHealthcheckStatus"
SYNTHETICSASSERTIONTYPE_CONNECTION SyntheticsAssertionType = "connection"
)

var allowedSyntheticsAssertionTypeEnumValues = []SyntheticsAssertionType{
Expand All @@ -48,6 +49,7 @@ var allowedSyntheticsAssertionTypeEnumValues = []SyntheticsAssertionType{
SYNTHETICSASSERTIONTYPE_PACKETS_RECEIVED,
SYNTHETICSASSERTIONTYPE_NETWORK_HOP,
SYNTHETICSASSERTIONTYPE_RECEIVED_MESSAGE,
SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS,
SYNTHETICSASSERTIONTYPE_CONNECTION,
}

Expand Down
2 changes: 1 addition & 1 deletion api/v1/datadog/model_synthetics_test_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type SyntheticsTestDetails struct {
// For browser test, the steps of the test.
Steps []SyntheticsStep `json:"steps,omitempty"`
// The subtype of the Synthetic API test, `http`, `ssl`, `tcp`,
// `dns`, `icmp`, `udp`, `websocket` or `multi`.
// `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`.
Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"`
// Array of tags attached to the test.
Tags []string `json:"tags,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion api/v1/datadog/model_synthetics_test_details_sub_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// SyntheticsTestDetailsSubType The subtype of the Synthetic API test, `http`, `ssl`, `tcp`,
// `dns`, `icmp`, `udp`, `websocket` or `multi`.
// `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`.
type SyntheticsTestDetailsSubType string

// List of SyntheticsTestDetailsSubType.
Expand All @@ -23,6 +23,7 @@ const (
SYNTHETICSTESTDETAILSSUBTYPE_ICMP SyntheticsTestDetailsSubType = "icmp"
SYNTHETICSTESTDETAILSSUBTYPE_UDP SyntheticsTestDetailsSubType = "udp"
SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET SyntheticsTestDetailsSubType = "websocket"
SYNTHETICSTESTDETAILSSUBTYPE_GRPC SyntheticsTestDetailsSubType = "grpc"
)

var allowedSyntheticsTestDetailsSubTypeEnumValues = []SyntheticsTestDetailsSubType{
Expand All @@ -34,6 +35,7 @@ var allowedSyntheticsTestDetailsSubTypeEnumValues = []SyntheticsTestDetailsSubTy
SYNTHETICSTESTDETAILSSUBTYPE_ICMP,
SYNTHETICSTESTDETAILSSUBTYPE_UDP,
SYNTHETICSTESTDETAILSSUBTYPE_WEBSOCKET,
SYNTHETICSTESTDETAILSSUBTYPE_GRPC,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down
78 changes: 78 additions & 0 deletions api/v1/datadog/model_synthetics_test_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type SyntheticsTestRequest struct {
Host *string `json:"host,omitempty"`
// Message to send for UDP or WebSocket tests.
Message *string `json:"message,omitempty"`
// Metadata to include when performing the gRPC test.
Metadata map[string]string `json:"metadata,omitempty"`
// The HTTP method.
Method *HTTPMethod `json:"method,omitempty"`
// Determines whether or not to save the response body.
Expand All @@ -46,6 +48,8 @@ type SyntheticsTestRequest struct {
// allowing the server to present one of multiple possible certificates on
// the same IP address and TCP port number.
Servername *string `json:"servername,omitempty"`
// gRPC service on which you want to perform the healthcheck.
Service *string `json:"service,omitempty"`
// Turns on a traceroute probe to discover all gateways along the path to the host destination.
ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"`
// Timeout in seconds for the test.
Expand Down Expand Up @@ -394,6 +398,38 @@ func (o *SyntheticsTestRequest) SetMessage(v string) {
o.Message = &v
}

// GetMetadata returns the Metadata field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetMetadata() map[string]string {
if o == nil || o.Metadata == nil {
var ret map[string]string
return ret
}
return o.Metadata
}

// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsTestRequest) GetMetadataOk() (*map[string]string, bool) {
if o == nil || o.Metadata == nil {
return nil, false
}
return &o.Metadata, true
}

// HasMetadata returns a boolean if a field has been set.
func (o *SyntheticsTestRequest) HasMetadata() bool {
if o != nil && o.Metadata != nil {
return true
}

return false
}

// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field.
func (o *SyntheticsTestRequest) SetMetadata(v map[string]string) {
o.Metadata = v
}

// GetMethod returns the Method field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetMethod() HTTPMethod {
if o == nil || o.Method == nil {
Expand Down Expand Up @@ -618,6 +654,38 @@ func (o *SyntheticsTestRequest) SetServername(v string) {
o.Servername = &v
}

// GetService returns the Service field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetService() string {
if o == nil || o.Service == nil {
var ret string
return ret
}
return *o.Service
}

// GetServiceOk returns a tuple with the Service field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsTestRequest) GetServiceOk() (*string, bool) {
if o == nil || o.Service == nil {
return nil, false
}
return o.Service, true
}

// HasService returns a boolean if a field has been set.
func (o *SyntheticsTestRequest) HasService() bool {
if o != nil && o.Service != nil {
return true
}

return false
}

// SetService gets a reference to the given string and assigns it to the Service field.
func (o *SyntheticsTestRequest) SetService(v string) {
o.Service = &v
}

// GetShouldTrackHops returns the ShouldTrackHops field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetShouldTrackHops() bool {
if o == nil || o.ShouldTrackHops == nil {
Expand Down Expand Up @@ -750,6 +818,9 @@ func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) {
if o.Message != nil {
toSerialize["message"] = o.Message
}
if o.Metadata != nil {
toSerialize["metadata"] = o.Metadata
}
if o.Method != nil {
toSerialize["method"] = o.Method
}
Expand All @@ -771,6 +842,9 @@ func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) {
if o.Servername != nil {
toSerialize["servername"] = o.Servername
}
if o.Service != nil {
toSerialize["service"] = o.Service
}
if o.ShouldTrackHops != nil {
toSerialize["shouldTrackHops"] = o.ShouldTrackHops
}
Expand Down Expand Up @@ -801,13 +875,15 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
Headers map[string]string `json:"headers,omitempty"`
Host *string `json:"host,omitempty"`
Message *string `json:"message,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Method *HTTPMethod `json:"method,omitempty"`
NoSavingResponseBody *bool `json:"noSavingResponseBody,omitempty"`
NumberOfPackets *int32 `json:"numberOfPackets,omitempty"`
Port *int64 `json:"port,omitempty"`
Proxy *SyntheticsTestRequestProxy `json:"proxy,omitempty"`
Query interface{} `json:"query,omitempty"`
Servername *string `json:"servername,omitempty"`
Service *string `json:"service,omitempty"`
ShouldTrackHops *bool `json:"shouldTrackHops,omitempty"`
Timeout *float64 `json:"timeout,omitempty"`
Url *string `json:"url,omitempty"`
Expand Down Expand Up @@ -846,6 +922,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
o.Headers = all.Headers
o.Host = all.Host
o.Message = all.Message
o.Metadata = all.Metadata
o.Method = all.Method
o.NoSavingResponseBody = all.NoSavingResponseBody
o.NumberOfPackets = all.NumberOfPackets
Expand All @@ -860,6 +937,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
o.Proxy = all.Proxy
o.Query = all.Query
o.Servername = all.Servername
o.Service = all.Service
o.ShouldTrackHops = all.ShouldTrackHops
o.Timeout = all.Timeout
o.Url = all.Url
Expand Down
66 changes: 66 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest_1402674167.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Create an API GRPC test returns "OK - Returns the created test details." response

package main

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

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

func main() {
body := datadog.SyntheticsAPITest{
Config: datadog.SyntheticsAPITestConfig{
Assertions: []datadog.SyntheticsAssertion{
datadog.SyntheticsAssertion{
SyntheticsAssertionTarget: &datadog.SyntheticsAssertionTarget{
Operator: datadog.SYNTHETICSASSERTIONOPERATOR_IS,
Target: 1,
Type: datadog.SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS,
}},
},
Request: &datadog.SyntheticsTestRequest{
Host: datadog.PtrString("localhost"),
Port: datadog.PtrInt64(50051),
Service: datadog.PtrString("Hello"),
Method: datadog.HTTPMETHOD_GET.Ptr(),
Message: datadog.PtrString(""),
Metadata: map[string]string{},
},
},
Locations: []string{
"aws:us-east-2",
},
Message: datadog.PtrString("BDD test payload: synthetics_api_grpc_test_payload.json"),
Name: "Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",
Options: datadog.SyntheticsTestOptions{
MinFailureDuration: datadog.PtrInt64(0),
MinLocationFailed: datadog.PtrInt64(1),
MonitorOptions: &datadog.SyntheticsTestOptionsMonitorOptions{
RenotifyInterval: datadog.PtrInt64(0),
},
MonitorName: datadog.PtrString("Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response"),
TickEvery: datadog.PtrInt64(60),
},
Subtype: datadog.SYNTHETICSTESTDETAILSSUBTYPE_GRPC.Ptr(),
Tags: []string{
"testing:api",
},
Type: datadog.SYNTHETICSAPITESTTYPE_API,
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.SyntheticsApi.CreateSyntheticsAPITest(ctx, body)

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

responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\n%s\n", responseContent)
}
Loading