Skip to content
Open
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
58 changes: 58 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86549,6 +86549,34 @@ components:
required:
- data
type: object
TestExample:
description: A test example resource.
properties:
created_at:
description: Creation time of the test example.
format: date-time
readOnly: true
type: string
id:
description: The ID of the test example.
example: "abc-123"
type: string
name:
description: The name of the test example.
example: "My Test Example"
type: string
required:
- id
- name
type: object
TestExamplesResponse:
description: Response containing a list of test examples.
properties:
data:
items:
$ref: "#/components/schemas/TestExample"
type: array
type: object
TestOptimizationDeleteServiceSettingsRequest:
description: Request object for deleting Test Optimization service settings.
properties:
Expand Down Expand Up @@ -158742,6 +158770,34 @@ paths:
operator: OR
permissions:
- teams_read
/api/v2/test-examples:
get:
description: Get a list of all test examples.
operationId: ListTestExamples
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- id: "abc-123"
name: "My Test Example"
schema:
$ref: "#/components/schemas/TestExamplesResponse"
description: OK
"403":
$ref: "#/components/responses/ForbiddenResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
summary: List test examples
tags:
- Test Examples
x-permission:
operator: OR
permissions:
- test_read
/api/v2/test/flaky-test-management/tests:
patch:
description: |-
Expand Down Expand Up @@ -162115,6 +162171,8 @@ tags:
name: Synthetics
- description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information.
name: Teams
- description: Manage test example resources.
name: Test Examples
- description: |-
Search and manage flaky tests through Test Optimization. See the [Test Optimization page](https://docs.datadoghq.com/tests/) for more information.
name: Test Optimization
Expand Down
5 changes: 5 additions & 0 deletions examples/v2/test-examples/ListTestExamples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List test examples returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::TestExamplesAPI.new
p api_instance.list_test_examples()
12 changes: 12 additions & 0 deletions features/v2/test_examples.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@endpoint(test-examples) @endpoint(test-examples-v2)
Feature: Test Examples
Manage test example resources.

@generated @skip @team:DataDog/webframeworks-test
Scenario: List test examples returns "OK" response
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "TestExamples" API
And new "ListTestExamples" request
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7776,6 +7776,12 @@
"type": "idempotent"
}
},
"ListTestExamples": {
"tag": "Test Examples",
"undo": {
"type": "safe"
}
},
"UpdateFlakyTests": {
"tag": "Test Optimization",
"undo": {
Expand Down
3 changes: 3 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6465,6 +6465,8 @@ def overrides
"v2.tenancy_products_data_attributes_products_items" => "TenancyProductsDataAttributesProductsItems",
"v2.tenancy_products_data_type" => "TenancyProductsDataType",
"v2.tenancy_products_list" => "TenancyProductsList",
"v2.test_example" => "TestExample",
"v2.test_examples_response" => "TestExamplesResponse",
"v2.test_optimization_delete_service_settings_request" => "TestOptimizationDeleteServiceSettingsRequest",
"v2.test_optimization_delete_service_settings_request_attributes" => "TestOptimizationDeleteServiceSettingsRequestAttributes",
"v2.test_optimization_delete_service_settings_request_data" => "TestOptimizationDeleteServiceSettingsRequestData",
Expand Down Expand Up @@ -6969,6 +6971,7 @@ def overrides
"v2.storage_management_api" => "StorageManagementAPI",
"v2.synthetics_api" => "SyntheticsAPI",
"v2.teams_api" => "TeamsAPI",
"v2.test_examples_api" => "TestExamplesAPI",
"v2.test_optimization_api" => "TestOptimizationAPI",
"v2.usage_metering_api" => "UsageMeteringAPI",
"v2.users_api" => "UsersAPI",
Expand Down
86 changes: 86 additions & 0 deletions lib/datadog_api_client/v2/api/test_examples_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=begin
#Datadog API V2 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.

=end

require 'cgi'

module DatadogAPIClient::V2
class TestExamplesAPI
attr_accessor :api_client

def initialize(api_client = DatadogAPIClient::APIClient.default)
@api_client = api_client
end

# List test examples.
#
# @see #list_test_examples_with_http_info
def list_test_examples(opts = {})
data, _status_code, _headers = list_test_examples_with_http_info(opts)
data
end

# List test examples.
#
# Get a list of all test examples.
#
# @param opts [Hash] the optional parameters
# @return [Array<(TestExamplesResponse, Integer, Hash)>] TestExamplesResponse data, response status code and response headers
def list_test_examples_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TestExamplesAPI.list_test_examples ...'
end
# resource path
local_var_path = '/api/v2/test-examples'

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'TestExamplesResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :list_test_examples,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TestExamplesAPI#list_test_examples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
154 changes: 154 additions & 0 deletions lib/datadog_api_client/v2/models/test_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
=begin
#Datadog API V2 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.

=end

require 'date'
require 'time'

module DatadogAPIClient::V2
# A test example resource.
class TestExample
include BaseGenericModel

# Creation time of the test example.
attr_accessor :created_at

# The ID of the test example.
attr_reader :id

# The name of the test example.
attr_reader :name

attr_accessor :additional_properties

# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.attribute_map
{
:'created_at' => :'created_at',
:'id' => :'id',
:'name' => :'name'
}
end

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'created_at' => :'Time',
:'id' => :'String',
:'name' => :'String'
}
end

# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TestExample` initialize method"
end

self.additional_properties = {}
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
self.additional_properties[k.to_sym] = v
else
h[k.to_sym] = v
end
}

if attributes.key?(:'created_at')
self.created_at = attributes[:'created_at']
end

if attributes.key?(:'id')
self.id = attributes[:'id']
end

if attributes.key?(:'name')
self.name = attributes[:'name']
end
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
# @!visibility private
def valid?
return false if @id.nil?
return false if @name.nil?
true
end

# Custom attribute writer method with validation
# @param id [Object] Object to be assigned
# @!visibility private
def id=(id)
if id.nil?
fail ArgumentError, 'invalid value for "id", id cannot be nil.'
end
@id = id
end

# Custom attribute writer method with validation
# @param name [Object] Object to be assigned
# @!visibility private
def name=(name)
if name.nil?
fail ArgumentError, 'invalid value for "name", name cannot be nil.'
end
@name = name
end

# Returns the object in the form of hash, with additionalProperties support.
# @return [Hash] Returns the object in the form of hash
# @!visibility private
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end

hash[param] = _to_hash(value)
end
self.additional_properties.each_pair do |attr, value|
hash[attr] = value
end
hash
end

# Checks equality by comparing each attribute.
# @param o [Object] Object to be compared
# @!visibility private
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
created_at == o.created_at &&
id == o.id &&
name == o.name &&
additional_properties == o.additional_properties
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[created_at, id, name, additional_properties].hash
end
end
end
Loading
Loading