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
76 changes: 73 additions & 3 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56750,19 +56750,35 @@ components:
- client_email
type: object
LogsArchiveIntegrationS3:
description: The S3 Archive's integration destination.
description: >-
The S3 Archive's integration destination. You must provide one of the following: `access_key_id` alone, or both `account_id` and `role_name` together.
oneOf:
- $ref: "#/components/schemas/LogsArchiveIntegrationS3AccessKey"
- $ref: "#/components/schemas/LogsArchiveIntegrationS3Role"
LogsArchiveIntegrationS3AccessKey:
description: The S3 Archive's integration destination using an access key.
properties:
access_key_id:
description: The access key ID for the integration.
example: AKIAIOSFODNN7EXAMPLE
type: string
required:
- access_key_id
type: object
LogsArchiveIntegrationS3Role:
description: The S3 Archive's integration destination using an IAM role.
properties:
account_id:
description: The account ID for the integration.
example: "123456789012"
type: string
role_name:
description: The path of the integration.
description: The name of the role to assume for the integration.
example: role-name
type: string
required:
- role_name
- account_id
- role_name
type: object
LogsArchiveOrder:
description: A ordered list of archive IDs.
Expand Down Expand Up @@ -148590,6 +148606,18 @@ paths:
- team:intake
- team:app
type: archives
s3_access_key_id:
value:
data:
attributes:
destination:
bucket: my-bucket
integration:
access_key_id: AKIAIOSFODNN7EXAMPLE
type: s3
name: Nginx Archive
query: source:nginx
type: archives
schema:
$ref: "#/components/schemas/LogsArchiveCreateRequest"
description: The definition of the new archive.
Expand All @@ -148615,6 +148643,21 @@ paths:
state: WORKING
id: 00000000-0000-0000-0000-000000000002
type: archives
s3_access_key_id:
value:
data:
attributes:
destination:
bucket: my-bucket
integration:
access_key_id: AKIAIOSFODNN7EXAMPLE
type: s3
include_tags: false
name: Nginx Archive
query: source:nginx
state: WORKING
id: 00000000-0000-0000-0000-000000000002
type: archives
schema:
$ref: "#/components/schemas/LogsArchive"
description: OK
Expand Down Expand Up @@ -148764,6 +148807,18 @@ paths:
- team:intake
- team:app
type: archives
s3_access_key_id:
value:
data:
attributes:
destination:
bucket: my-bucket
integration:
access_key_id: AKIAIOSFODNN7EXAMPLE
type: s3
name: Nginx Archive
query: source:nginx
type: archives
schema:
$ref: "#/components/schemas/LogsArchiveCreateRequest"
description: New definition of the archive.
Expand All @@ -148789,6 +148844,21 @@ paths:
state: WORKING
id: 00000000-0000-0000-0000-000000000004
type: archives
s3_access_key_id:
value:
data:
attributes:
destination:
bucket: my-bucket
integration:
access_key_id: AKIAIOSFODNN7EXAMPLE
type: s3
include_tags: false
name: Nginx Archive
query: source:nginx
state: WORKING
id: 00000000-0000-0000-0000-000000000004
type: archives
schema:
$ref: "#/components/schemas/LogsArchive"
description: OK
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 @@ -4447,6 +4447,8 @@ def overrides
"v2.logs_archive_integration_azure" => "LogsArchiveIntegrationAzure",
"v2.logs_archive_integration_gcs" => "LogsArchiveIntegrationGCS",
"v2.logs_archive_integration_s3" => "LogsArchiveIntegrationS3",
"v2.logs_archive_integration_s3_access_key" => "LogsArchiveIntegrationS3AccessKey",
"v2.logs_archive_integration_s3_role" => "LogsArchiveIntegrationS3Role",
"v2.logs_archive_order" => "LogsArchiveOrder",
"v2.logs_archive_order_attributes" => "LogsArchiveOrderAttributes",
"v2.logs_archive_order_definition" => "LogsArchiveOrderDefinition",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LogsArchiveDestinationS3
# The S3 encryption settings.
attr_accessor :encryption

# The S3 Archive's integration destination.
# The S3 Archive's integration destination. You must provide one of the following: `access_key_id` alone, or both `account_id` and `role_name` together.
attr_reader :integration

# The archive path.
Expand Down
153 changes: 36 additions & 117 deletions lib/datadog_api_client/v2/models/logs_archive_integration_s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,128 +17,47 @@
require 'time'

module DatadogAPIClient::V2
# The S3 Archive's integration destination.
class LogsArchiveIntegrationS3
include BaseGenericModel

# The account ID for the integration.
attr_reader :account_id

# The path of the integration.
attr_reader :role_name

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'account_id' => :'String',
:'role_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::LogsArchiveIntegrationS3` initialize method"
# The S3 Archive's integration destination. You must provide one of the following: `access_key_id` alone, or both `account_id` and `role_name` together.
module LogsArchiveIntegrationS3
class << self
include BaseOneOfModel
include BaseOneOfModelNoDiscriminator

# List of class defined in oneOf (OpenAPI v3)
def openapi_one_of
[
:'LogsArchiveIntegrationS3AccessKey',
:'LogsArchiveIntegrationS3Role'
]
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
# Builds the object
# @param data [Mixed] Data to be matched against the list of oneOf items
# @return [Object] Returns the model or the data itself
def build(data)
# Go through the list of oneOf items and attempt to identify the appropriate one.
# Note:
# - We do not attempt to check whether exactly one item matches.
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
# - TODO: scalar values are de facto behaving as if they were nullable.
# - TODO: logging when debugging is set.
openapi_one_of.each do |klass|
begin
next if klass == :AnyType # "nullable: true"
typed_data = find_and_cast_into_type(klass, data)
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
return typed_data if typed_data
rescue # rescue all errors so we keep iterating even if the current item lookup raises
end
end
}

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

if attributes.key?(:'role_name')
self.role_name = attributes[:'role_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 @account_id.nil?
return false if @role_name.nil?
true
end

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

# Custom attribute writer method with validation
# @param role_name [Object] Object to be assigned
# @!visibility private
def role_name=(role_name)
if role_name.nil?
fail ArgumentError, 'invalid value for "role_name", role_name cannot be nil.'
end
@role_name = role_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}"))
if openapi_one_of.include?(:AnyType)
data
else
self._unparsed = true
DatadogAPIClient::UnparsedObject.new(data)
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 &&
account_id == o.account_id &&
role_name == o.role_name &&
additional_properties == o.additional_properties
end

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