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
98 changes: 98 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71914,6 +71914,55 @@ components:
$ref: "#/components/schemas/Trigger"
type: array
type: object
SpecAttributes:
description: Attributes of an API spec.
properties:
name:
description: The name of the spec.
example: pets-api
type: string
status:
$ref: "#/components/schemas/SpecAttributesStatus"
version:
description: The version of the spec.
example: "2.1.0"
type: string
type: object
SpecAttributesStatus:
description: The publication status of the spec.
enum:
- published
- draft
- deprecated
example: published
type: string
x-enum-varnames:
- PUBLISHED
- DRAFT
- DEPRECATED
SpecData:
description: A single API spec resource.
properties:
attributes:
$ref: "#/components/schemas/SpecAttributes"
id:
description: The unique identifier of the spec.
example: d5e5d5a0-1234-5678-9abc-def012345678
type: string
type:
$ref: "#/components/schemas/SpecType"
required:
- type
type: object
SpecType:
default: spec
description: Type of the spec resource.
enum:
- spec
example: spec
type: string
x-enum-varnames:
- SPEC
SpecVersion:
description: The version of the CycloneDX specification a BOM conforms to.
enum:
Expand All @@ -71932,6 +71981,15 @@ components:
- ONE_THREE
- ONE_FOUR
- ONE_FIVE
SpecsListResponse:
description: Response containing a list of specs.
properties:
data:
description: List of specs.
items:
$ref: "#/components/schemas/SpecData"
type: array
type: object
SplitAPIKey:
description: The definition of the `SplitAPIKey` object.
properties:
Expand Down Expand Up @@ -137984,6 +138042,43 @@ paths:
cursorPath: meta.page.after
limitParam: body.data.attributes.page.limit
resultsPath: data
/api/v2/specs:
get:
description: Returns a list of API specs stored in the system.
operationId: ListSpecs
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- attributes:
name: pets-api
status: published
version: "2.1.0"
id: d5e5d5a0-1234-5678-9abc-def012345678
type: spec
- attributes:
name: users-api
status: draft
version: "1.0.0"
id: a1b2c3d4-5678-9abc-def0-123456789abc
type: spec
schema:
$ref: "#/components/schemas/SpecsListResponse"
description: OK
"403":
$ref: "#/components/responses/ForbiddenResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: List API specs
tags:
- Specs
/api/v2/static-analysis-sca/dependencies:
post:
operationId: CreateSCAResult
Expand Down Expand Up @@ -148377,6 +148472,9 @@ tags:
description: Find out more at
url: https://docs.datadoghq.com/tracing/metrics/metrics_namespace/
name: Spans Metrics
- description: |-
View API specs stored in the system.
name: Specs
- description: API for static analysis
name: Static Analysis
- description: Manage your status pages and communicate service disruptions to stakeholders via Datadog's API. See the [Status Pages documentation](https://docs.datadoghq.com/incident_response/status_pages/) for more information.
Expand Down
5 changes: 5 additions & 0 deletions examples/v2/specs/ListSpecs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List API specs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SpecsAPI.new
p api_instance.list_specs()
12 changes: 12 additions & 0 deletions features/v2/specs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@endpoint(specs) @endpoint(specs-v2)
Feature: Specs
View API specs stored in the system.

@generated @skip @team:DataDog/web-frameworks-test
Scenario: List API specs returns "OK" response
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "Specs" API
And new "ListSpecs" 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 @@ -6252,6 +6252,12 @@
"type": "safe"
}
},
"ListSpecs": {
"tag": "Specs",
"undo": {
"type": "safe"
}
},
"CreateSCAResult": {
"tag": "Static Analysis",
"undo": {
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5622,6 +5622,11 @@ def overrides
"v2.spans_type" => "SpansType",
"v2.spans_warning" => "SpansWarning",
"v2.spec" => "Spec",
"v2.spec_attributes" => "SpecAttributes",
"v2.spec_attributes_status" => "SpecAttributesStatus",
"v2.spec_data" => "SpecData",
"v2.specs_list_response" => "SpecsListResponse",
"v2.spec_type" => "SpecType",
"v2.spec_version" => "SpecVersion",
"v2.split_api_key" => "SplitAPIKey",
"v2.split_api_key_type" => "SplitAPIKeyType",
Expand Down Expand Up @@ -6548,6 +6553,7 @@ def overrides
"v2.spa_api" => "SpaAPI",
"v2.spans_api" => "SpansAPI",
"v2.spans_metrics_api" => "SpansMetricsAPI",
"v2.specs_api" => "SpecsAPI",
"v2.static_analysis_api" => "StaticAnalysisAPI",
"v2.status_pages_api" => "StatusPagesAPI",
"v2.storage_management_api" => "StorageManagementAPI",
Expand Down
86 changes: 86 additions & 0 deletions lib/datadog_api_client/v2/api/specs_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 SpecsAPI
attr_accessor :api_client

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

# List API specs.
#
# @see #list_specs_with_http_info
def list_specs(opts = {})
data, _status_code, _headers = list_specs_with_http_info(opts)
data
end

# List API specs.
#
# Returns a list of API specs stored in the system.
#
# @param opts [Hash] the optional parameters
# @return [Array<(SpecsListResponse, Integer, Hash)>] SpecsListResponse data, response status code and response headers
def list_specs_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SpecsAPI.list_specs ...'
end
# resource path
local_var_path = '/api/v2/specs'

# 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] || 'SpecsListResponse'

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

new_options = opts.merge(
:operation => :list_specs,
: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: SpecsAPI#list_specs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
125 changes: 125 additions & 0 deletions lib/datadog_api_client/v2/models/spec_attributes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
=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
# Attributes of an API spec.
class SpecAttributes
include BaseGenericModel

# The name of the spec.
attr_accessor :name

# The publication status of the spec.
attr_accessor :status

# The version of the spec.
attr_accessor :version

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'name' => :'String',
:'status' => :'SpecAttributesStatus',
:'version' => :'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::SpecAttributes` 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?(:'name')
self.name = attributes[:'name']
end

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

if attributes.key?(:'version')
self.version = attributes[:'version']
end
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 &&
name == o.name &&
status == o.status &&
version == o.version &&
additional_properties == o.additional_properties
end

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