Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MSTeams integration metadata info #2045

Merged
Merged
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
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-10-04 10:38:27.221073",
"spec_repo_commit": "7a63d530"
"regenerated": "2024-10-04 15:31:54.748352",
"spec_repo_commit": "f28ad048"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-04 10:38:27.235409",
"spec_repo_commit": "7a63d530"
"regenerated": "2024-10-04 15:31:54.762784",
"spec_repo_commit": "f28ad048"
}
}
}
38 changes: 38 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10640,6 +10640,7 @@ components:
oneOf:
- $ref: '#/components/schemas/SlackIntegrationMetadata'
- $ref: '#/components/schemas/JiraIntegrationMetadata'
- $ref: '#/components/schemas/MSTeamsIntegrationMetadata'
IncidentIntegrationMetadataPatchData:
description: Incident integration metadata data for a patch request.
properties:
Expand Down Expand Up @@ -13634,6 +13635,43 @@ components:
from the other indexes
type: string
type: object
MSTeamsIntegrationMetadata:
description: Incident integration metadata for the Microsoft Teams integration.
properties:
teams:
description: Array of Microsoft Teams in this integration metadata.
example: []
items:
$ref: '#/components/schemas/MSTeamsIntegrationMetadataTeamsItem'
type: array
required:
- teams
type: object
MSTeamsIntegrationMetadataTeamsItem:
description: Item in the Microsoft Teams integration metadata teams array.
properties:
ms_channel_id:
description: Microsoft Teams channel ID.
example: 19:[email protected]
type: string
ms_channel_name:
description: Microsoft Teams channel name.
example: incident-0001-example
type: string
ms_tenant_id:
description: Microsoft Teams tenant ID.
example: 00000000-abcd-0005-0000-000000000000
type: string
redirect_url:
description: URL redirecting to the Microsoft Teams channel.
example: https://teams.microsoft.com/l/channel/19%3Aabc00abcdef00a0abcdef0abcdef0a%40thread.tacv2/conversations?groupId=12345678-abcd-dcba-abcd-1234567890ab&tenantId=00000000-abcd-0005-0000-000000000000
type: string
required:
- ms_tenant_id
- ms_channel_id
- ms_channel_name
- redirect_url
type: object
Metric:
description: Object for a single metric tag configuration.
example:
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,8 @@ def overrides
"v2.monthly_cost_attribution_meta" => "MonthlyCostAttributionMeta",
"v2.monthly_cost_attribution_pagination" => "MonthlyCostAttributionPagination",
"v2.monthly_cost_attribution_response" => "MonthlyCostAttributionResponse",
"v2.ms_teams_integration_metadata" => "MSTeamsIntegrationMetadata",
"v2.ms_teams_integration_metadata_teams_item" => "MSTeamsIntegrationMetadataTeamsItem",
"v2.nullable_relationship_to_user" => "NullableRelationshipToUser",
"v2.nullable_relationship_to_user_data" => "NullableRelationshipToUserData",
"v2.nullable_user_relationship" => "NullableUserRelationship",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class << self
def openapi_one_of
[
:'SlackIntegrationMetadata',
:'JiraIntegrationMetadata'
:'JiraIntegrationMetadata',
:'MSTeamsIntegrationMetadata'
]
end
# Builds the object
Expand Down
125 changes: 125 additions & 0 deletions lib/datadog_api_client/v2/models/ms_teams_integration_metadata.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: [email protected]
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
# Incident integration metadata for the Microsoft Teams integration.
class MSTeamsIntegrationMetadata
include BaseGenericModel

# Array of Microsoft Teams in this integration metadata.
attr_reader :teams

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'teams' => :'Array<MSTeamsIntegrationMetadataTeamsItem>'
}
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::MSTeamsIntegrationMetadata` 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?(:'teams')
if (value = attributes[:'teams']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.teams = 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 @teams.nil?
true
end

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

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