Skip to content

Commit

Permalink
Support providing files for the file upload feature when creating a S…
Browse files Browse the repository at this point in the history
…ynthetic API test (#2460)

Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Apr 5, 2024
1 parent c3cfe06 commit 19cf15e
Show file tree
Hide file tree
Showing 11 changed files with 632 additions and 11 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-04-04 19:22:30.504579",
"spec_repo_commit": "fd06108d"
"regenerated": "2024-04-05 17:05:08.760606",
"spec_repo_commit": "9b7c8967"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-04 19:22:30.523928",
"spec_repo_commit": "fd06108d"
"regenerated": "2024-04-05 17:05:08.779289",
"spec_repo_commit": "9b7c8967"
}
}
}
35 changes: 35 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15871,6 +15871,11 @@ components:
maximum: 65535
minimum: 1
type: integer
files:
description: Files to be used as part of the request in the test.
items:
$ref: '#/components/schemas/SyntheticsTestRequestBodyFile'
type: array
follow_redirects:
description: Specifies whether or not the request follows redirects.
type: boolean
Expand Down Expand Up @@ -15937,6 +15942,32 @@ components:
example: https://example.com
type: string
type: object
SyntheticsTestRequestBodyFile:
description: Object describing a file to be used as part of the request in the
test.
properties:
bucketKey:
description: Bucket key of the file.
type: string
content:
description: Content of the file.
maxLength: 3145728
type: string
name:
description: Name of the file.
maxLength: 1500
type: string
size:
description: Size of the file.
format: int64
maximum: 3145728
minimum: 1
type: integer
type:
description: Type of the file.
maxLength: 1500
type: string
type: object
SyntheticsTestRequestBodyType:
description: Type of the request body.
enum:
Expand All @@ -15946,6 +15977,8 @@ components:
- text/html
- application/x-www-form-urlencoded
- graphql
- application/octet-stream
- multipart/form-data
example: text/plain
type: string
x-enum-varnames:
Expand All @@ -15955,6 +15988,8 @@ components:
- TEXT_HTML
- APPLICATION_X_WWW_FORM_URLENCODED
- GRAPHQL
- APPLICATION_OCTET_STREAM
- MULTIPART_FORM_DATA
SyntheticsTestRequestCertificate:
description: Client certificate to use when performing the test request.
properties:
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV1/model_synthetics_test_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type SyntheticsTestRequest struct {
DnsServer *string `json:"dnsServer,omitempty"`
// DNS server port to use for DNS tests.
DnsServerPort *int32 `json:"dnsServerPort,omitempty"`
// Files to be used as part of the request in the test.
Files []SyntheticsTestRequestBodyFile `json:"files,omitempty"`
// Specifies whether or not the request follows redirects.
FollowRedirects *bool `json:"follow_redirects,omitempty"`
// Headers to include when performing the test.
Expand Down Expand Up @@ -400,6 +402,34 @@ func (o *SyntheticsTestRequest) SetDnsServerPort(v int32) {
o.DnsServerPort = &v
}

// GetFiles returns the Files field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetFiles() []SyntheticsTestRequestBodyFile {
if o == nil || o.Files == nil {
var ret []SyntheticsTestRequestBodyFile
return ret
}
return o.Files
}

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

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

// SetFiles gets a reference to the given []SyntheticsTestRequestBodyFile and assigns it to the Files field.
func (o *SyntheticsTestRequest) SetFiles(v []SyntheticsTestRequestBodyFile) {
o.Files = v
}

// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise.
func (o *SyntheticsTestRequest) GetFollowRedirects() bool {
if o == nil || o.FollowRedirects == nil {
Expand Down Expand Up @@ -943,6 +973,9 @@ func (o SyntheticsTestRequest) MarshalJSON() ([]byte, error) {
if o.DnsServerPort != nil {
toSerialize["dnsServerPort"] = o.DnsServerPort
}
if o.Files != nil {
toSerialize["files"] = o.Files
}
if o.FollowRedirects != nil {
toSerialize["follow_redirects"] = o.FollowRedirects
}
Expand Down Expand Up @@ -1018,6 +1051,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
CompressedProtoFile *string `json:"compressedProtoFile,omitempty"`
DnsServer *string `json:"dnsServer,omitempty"`
DnsServerPort *int32 `json:"dnsServerPort,omitempty"`
Files []SyntheticsTestRequestBodyFile `json:"files,omitempty"`
FollowRedirects *bool `json:"follow_redirects,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Host *string `json:"host,omitempty"`
Expand All @@ -1042,7 +1076,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"allow_insecure", "basicAuth", "body", "bodyType", "callType", "certificate", "certificateDomains", "compressedJsonDescriptor", "compressedProtoFile", "dnsServer", "dnsServerPort", "follow_redirects", "headers", "host", "httpVersion", "message", "metadata", "method", "noSavingResponseBody", "numberOfPackets", "persistCookies", "port", "proxy", "query", "servername", "service", "shouldTrackHops", "timeout", "url"})
datadog.DeleteKeys(additionalProperties, &[]string{"allow_insecure", "basicAuth", "body", "bodyType", "callType", "certificate", "certificateDomains", "compressedJsonDescriptor", "compressedProtoFile", "dnsServer", "dnsServerPort", "files", "follow_redirects", "headers", "host", "httpVersion", "message", "metadata", "method", "noSavingResponseBody", "numberOfPackets", "persistCookies", "port", "proxy", "query", "servername", "service", "shouldTrackHops", "timeout", "url"})
} else {
return err
}
Expand Down Expand Up @@ -1070,6 +1104,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) {
o.CompressedProtoFile = all.CompressedProtoFile
o.DnsServer = all.DnsServer
o.DnsServerPort = all.DnsServerPort
o.Files = all.Files
o.FollowRedirects = all.FollowRedirects
o.Headers = all.Headers
o.Host = all.Host
Expand Down
Loading

0 comments on commit 19cf15e

Please sign in to comment.