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
457 changes: 457 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List shared dashboards for a dashboard returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_shared_dashboards_by_dashboard_id".to_sym] = true
end
api_instance = DatadogAPIClient::V2::DashboardSharingAPI.new
p api_instance.list_shared_dashboards_by_dashboard_id("abc-def-ghi")
3 changes: 3 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,9 @@
"dashboard_list_id" => "Integer",
"body" => "DashboardListUpdateItemsRequest",
},
"v2.ListSharedDashboardsByDashboardId" => {
"dashboard_id" => "String",
},
"v2.CreateDashboardSecureEmbed" => {
"dashboard_id" => "String",
"body" => "SecureEmbedCreateRequest",
Expand Down
22 changes: 22 additions & 0 deletions features/v2/dashboard_sharing.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@endpoint(dashboard-sharing) @endpoint(dashboard-sharing-v2)
Feature: Dashboard Sharing
Manage dashboard sharing configurations.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "DashboardSharing" API
And operation "ListSharedDashboardsByDashboardId" enabled
And new "ListSharedDashboardsByDashboardId" request

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: List shared dashboards for a dashboard returns "Dashboard Not Found" response
Given request contains "dashboard_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Dashboard Not Found

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: List shared dashboards for a dashboard returns "OK" response
Given request contains "dashboard_id" parameter from "REPLACE.ME"
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 @@ -2165,6 +2165,12 @@
"type": "safe"
}
},
"ListSharedDashboardsByDashboardId": {
"tag": "Dashboard Sharing",
"undo": {
"type": "safe"
}
},
"CreateDashboardSecureEmbed": {
"tag": "Dashboard Secure Embed",
"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 @@ -416,6 +416,7 @@ def initialize
"v2.list_csm_agentless_hosts": false,
"v2.list_csm_unified_host_facets": false,
"v2.list_csm_unified_hosts": false,
"v2.list_shared_dashboards_by_dashboard_id": false,
"v2.create_dashboard_secure_embed": false,
"v2.delete_dashboard_secure_embed": false,
"v2.get_dashboard_secure_embed": false,
Expand Down
21 changes: 21 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3967,6 +3967,7 @@ def overrides
"v2.list_scorecards_response" => "ListScorecardsResponse",
"v2.list_security_findings_response" => "ListSecurityFindingsResponse",
"v2.list_service_access_tokens_response" => "ListServiceAccessTokensResponse",
"v2.list_shared_dashboards_response" => "ListSharedDashboardsResponse",
"v2.list_sourcemaps_response" => "ListSourcemapsResponse",
"v2.list_tags_response" => "ListTagsResponse",
"v2.list_tags_response_data" => "ListTagsResponseData",
Expand Down Expand Up @@ -6471,6 +6472,25 @@ def overrides
"v2.service_repository_info_status" => "ServiceRepositoryInfoStatus",
"v2.session_id_array" => "SessionIdArray",
"v2.session_id_data" => "SessionIdData",
"v2.shared_dashboard_included" => "SharedDashboardIncluded",
"v2.shared_dashboard_included_dashboard" => "SharedDashboardIncludedDashboard",
"v2.shared_dashboard_included_dashboard_attributes" => "SharedDashboardIncludedDashboardAttributes",
"v2.shared_dashboard_included_dashboard_type" => "SharedDashboardIncludedDashboardType",
"v2.shared_dashboard_included_user" => "SharedDashboardIncludedUser",
"v2.shared_dashboard_included_user_attributes" => "SharedDashboardIncludedUserAttributes",
"v2.shared_dashboard_invitee" => "SharedDashboardInvitee",
"v2.shared_dashboard_relationship_dashboard" => "SharedDashboardRelationshipDashboard",
"v2.shared_dashboard_relationship_dashboard_data" => "SharedDashboardRelationshipDashboardData",
"v2.shared_dashboard_relationships" => "SharedDashboardRelationships",
"v2.shared_dashboard_relationship_sharer" => "SharedDashboardRelationshipSharer",
"v2.shared_dashboard_response" => "SharedDashboardResponse",
"v2.shared_dashboard_response_attributes" => "SharedDashboardResponseAttributes",
"v2.shared_dashboard_selectable_template_variable" => "SharedDashboardSelectableTemplateVariable",
"v2.shared_dashboard_share_type" => "SharedDashboardShareType",
"v2.shared_dashboard_status" => "SharedDashboardStatus",
"v2.shared_dashboard_type" => "SharedDashboardType",
"v2.shared_dashboard_viewing_preferences" => "SharedDashboardViewingPreferences",
"v2.shared_dashboard_viewing_preferences_theme" => "SharedDashboardViewingPreferencesTheme",
"v2.shift" => "Shift",
"v2.shift_data" => "ShiftData",
"v2.shift_data_attributes" => "ShiftDataAttributes",
Expand Down Expand Up @@ -7557,6 +7577,7 @@ def overrides
"v2.customer_org_api" => "CustomerOrgAPI",
"v2.dashboard_lists_api" => "DashboardListsAPI",
"v2.dashboard_secure_embed_api" => "DashboardSecureEmbedAPI",
"v2.dashboard_sharing_api" => "DashboardSharingAPI",
"v2.dashboards_api" => "DashboardsAPI",
"v2.data_deletion_api" => "DataDeletionAPI",
"v2.datasets_api" => "DatasetsAPI",
Expand Down
97 changes: 97 additions & 0 deletions lib/datadog_api_client/v2/api/dashboard_sharing_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
=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 DashboardSharingAPI
attr_accessor :api_client

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

# List shared dashboards for a dashboard.
#
# @see #list_shared_dashboards_by_dashboard_id_with_http_info
def list_shared_dashboards_by_dashboard_id(dashboard_id, opts = {})
data, _status_code, _headers = list_shared_dashboards_by_dashboard_id_with_http_info(dashboard_id, opts)
data
end

# List shared dashboards for a dashboard.
#
# Retrieve shared dashboards associated with the specified dashboard.
#
# @param dashboard_id [String] ID of the dashboard.
# @param opts [Hash] the optional parameters
# @return [Array<(ListSharedDashboardsResponse, Integer, Hash)>] ListSharedDashboardsResponse data, response status code and response headers
def list_shared_dashboards_by_dashboard_id_with_http_info(dashboard_id, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.list_shared_dashboards_by_dashboard_id".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_shared_dashboards_by_dashboard_id")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_shared_dashboards_by_dashboard_id"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DashboardSharingAPI.list_shared_dashboards_by_dashboard_id ...'
end
# verify the required parameter 'dashboard_id' is set
if @api_client.config.client_side_validation && dashboard_id.nil?
fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling DashboardSharingAPI.list_shared_dashboards_by_dashboard_id"
end
# resource path
local_var_path = '/api/v2/dashboard/{dashboard_id}/shared'.sub('{dashboard_id}', CGI.escape(dashboard_id.to_s).gsub('%2F', '/'))

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

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

new_options = opts.merge(
:operation => :list_shared_dashboards_by_dashboard_id,
: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: DashboardSharingAPI#list_shared_dashboards_by_dashboard_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
148 changes: 148 additions & 0 deletions lib/datadog_api_client/v2/models/list_shared_dashboards_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
=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
# Response containing shared dashboards for a dashboard.
class ListSharedDashboardsResponse
include BaseGenericModel

# Shared dashboards for the dashboard.
attr_reader :data

# Users and dashboards related to the shared dashboards.
attr_reader :included

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'data' => :'Array<SharedDashboardResponse>',
:'included' => :'Array<SharedDashboardIncluded>'
}
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::ListSharedDashboardsResponse` 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')
if (value = attributes[:'data']).is_a?(Array)
self.data = value
end
end

if attributes.key?(:'included')
if (value = attributes[:'included']).is_a?(Array)
self.included = value
end
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 @data.nil?
return false if @included.nil?
true
end

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

# Custom attribute writer method with validation
# @param included [Object] Object to be assigned
# @!visibility private
def included=(included)
if included.nil?
fail ArgumentError, 'invalid value for "included", included cannot be nil.'
end
@included = included
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 &&
included == o.included &&
additional_properties == o.additional_properties
end

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