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
70 changes: 70 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36135,6 +36135,51 @@ components:
required:
- name
type: object
LicensesListRequest:
properties:
data:
$ref: '#/components/schemas/LicensesListRequestData'
type: object
LicensesListRequestData:
properties:
attributes:
$ref: '#/components/schemas/LicensesListRequestDataAttributes'
id:
description: Unique identifier for the request
type: string
type:
$ref: '#/components/schemas/LicensesListRequestDataType'
required:
- type
type: object
LicensesListRequestDataAttributes:
properties:
licenses:
description: List of available licenses
items:
$ref: '#/components/schemas/LicensesListRequestLicense'
type: array
type: object
LicensesListRequestDataType:
default: licenserequest
enum:
- licenserequest
example: licenserequest
type: string
x-enum-varnames:
- LICENSEREQUEST
LicensesListRequestLicense:
properties:
display_name:
description: The display name of the license
type: string
identifier:
description: The SPDX identifier of the license
type: string
short_name:
description: The short name of the license
type: string
type: object
Links:
description: The JSON:API links related to pagination.
properties:
Expand Down Expand Up @@ -104994,6 +105039,31 @@ paths:
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/licenses/list:
get:
description: Returns a list of all available license identifiers and display
names that can be used for filtering and categorization in SCA.
operationId: GetLicenses
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LicensesListRequest'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- code_analysis_read
summary: Get list of available licenses
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols:
post:
operationId: CreateSCAResolveVulnerableSymbols
Expand Down
8 changes: 8 additions & 0 deletions examples/v2/static-analysis/GetLicenses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Get list of available licenses returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_licenses".to_sym] = true
end
api_instance = DatadogAPIClient::V2::StaticAnalysisAPI.new
p api_instance.get_licenses()
7 changes: 7 additions & 0 deletions features/v2/static_analysis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ Feature: Static Analysis
When the request is sent
Then the response status is 200 Successfully deleted

@generated @skip @team:DataDog/k9-vm-sca
Scenario: Get list of available licenses returns "OK" response
Given operation "GetLicenses" enabled
And new "GetLicenses" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/k9-vm-ast
Scenario: List Custom Rule Revisions returns "Bad request" response
Given operation "ListCustomRuleRevisions" enabled
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5410,6 +5410,12 @@
"type": "safe"
}
},
"GetLicenses": {
"tag": "Static Analysis",
"undo": {
"type": "safe"
}
},
"CreateSCAResolveVulnerableSymbols": {
"tag": "Static Analysis",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ def initialize
"v2.get_custom_rule": false,
"v2.get_custom_rule_revision": false,
"v2.get_custom_ruleset": false,
"v2.get_licenses": false,
"v2.list_custom_rule_revisions": false,
"v2.revert_custom_rule_revision": false,
"v2.update_custom_ruleset": false,
Expand Down
5 changes: 5 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3120,6 +3120,11 @@ def overrides
"v2.leaked_key_attributes" => "LeakedKeyAttributes",
"v2.leaked_key_type" => "LeakedKeyType",
"v2.library" => "Library",
"v2.licenses_list_request" => "LicensesListRequest",
"v2.licenses_list_request_data" => "LicensesListRequestData",
"v2.licenses_list_request_data_attributes" => "LicensesListRequestDataAttributes",
"v2.licenses_list_request_data_type" => "LicensesListRequestDataType",
"v2.licenses_list_request_license" => "LicensesListRequestLicense",
"v2.links" => "Links",
"v2.list_apis_response" => "ListAPIsResponse",
"v2.list_apis_response_data" => "ListAPIsResponseData",
Expand Down
66 changes: 66 additions & 0 deletions lib/datadog_api_client/v2/api/static_analysis_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,72 @@ def get_custom_ruleset_with_http_info(ruleset_name, opts = {})
return data, status_code, headers
end

# Get list of available licenses.
#
# @see #get_licenses_with_http_info
def get_licenses(opts = {})
data, _status_code, _headers = get_licenses_with_http_info(opts)
data
end

# Get list of available licenses.
#
# Returns a list of all available license identifiers and display names that can be used for filtering and categorization in SCA.
#
# @param opts [Hash] the optional parameters
# @return [Array<(LicensesListRequest, Integer, Hash)>] LicensesListRequest data, response status code and response headers
def get_licenses_with_http_info(opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_licenses".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_licenses")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_licenses"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: StaticAnalysisAPI.get_licenses ...'
end
# resource path
local_var_path = '/api/v2/static-analysis-sca/licenses/list'

# 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(['*/*'])

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

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

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

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

new_options = opts.merge(
:operation => :get_licenses,
: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: StaticAnalysisAPI#get_licenses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# List Custom Rule Revisions.
#
# @see #list_custom_rule_revisions_with_http_info
Expand Down
105 changes: 105 additions & 0 deletions lib/datadog_api_client/v2/models/licenses_list_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
=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
#
class LicensesListRequest
include BaseGenericModel

#
attr_accessor :data

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'data' => :'LicensesListRequestData'
}
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::LicensesListRequest` 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?(:'data')
self.data = attributes[:'data']
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 &&
data == o.data &&
additional_properties == o.additional_properties
end

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