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
13 changes: 11 additions & 2 deletions .github/workflows/e2e-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ on:
options:
- 'true'
- 'false'
run_traffic_peak_tests:
description: 'Set this parameter to "true" to run ACLP logs TrafficPeak destination related test cases'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
run_db_fork_tests:
description: 'Set this parameter to "true" to run fork database related test cases'
required: false
Expand Down Expand Up @@ -112,12 +120,13 @@ jobs:
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_sdk_test_report.xml"
make test-int RUN_DB_FORK_TESTS="$RUN_DB_FORK_TESTS" RUN_DB_TESTS="$RUN_DB_TESTS" RUN_ACLP_LOGS_STREAM_TESTS="$RUN_ACLP_LOGS_STREAM_TESTS" TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="$TEST_SUITE"
make test-int RUN_DB_FORK_TESTS="$RUN_DB_FORK_TESTS" RUN_DB_TESTS="$RUN_DB_TESTS" RUN_ACLP_LOGS_STREAM_TESTS="$RUN_ACLP_LOGS_STREAM_TESTS" RUN_TRAFFIC_PEAK_TESTS="$RUN_TRAFFIC_PEAK_TESTS" TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="$TEST_SUITE"
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
RUN_DB_FORK_TESTS: ${{ github.event.inputs.run_db_fork_tests }}
RUN_DB_TESTS: ${{ github.event.inputs.run_db_tests }}
RUN_ACLP_LOGS_STREAM_TESTS: ${{ github.event.inputs.run_aclp_logs_stream_tests }}
RUN_TRAFFIC_PEAK_TESTS: ${{ github.event.inputs.run_traffic_peak_tests }}
TEST_SUITE: ${{ github.event.inputs.test_suite }}

- name: Upload test results
Expand Down Expand Up @@ -218,4 +227,4 @@ jobs:
fi
done
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
11 changes: 10 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ on:
options:
- 'true'
- 'false'
run_traffic_peak_tests:
description: 'Set this parameter to "true" to run TrafficPeak related test cases'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
run_db_fork_tests:
description: 'Set this parameter to "true" to run fork database related test cases'
required: false
Expand Down Expand Up @@ -107,12 +115,13 @@ jobs:
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_sdk_test_report.xml"
make test-int RUN_DB_FORK_TESTS="$RUN_DB_FORK_TESTS" RUN_DB_TESTS="$RUN_DB_TESTS" RUN_ACLP_LOGS_STREAM_TESTS="$RUN_ACLP_LOGS_STREAM_TESTS" TEST_SUITE="$TEST_SUITE" TEST_ARGS="--junitxml=${report_filename}"
make test-int RUN_DB_FORK_TESTS="$RUN_DB_FORK_TESTS" RUN_DB_TESTS="$RUN_DB_TESTS" RUN_ACLP_LOGS_STREAM_TESTS="$RUN_ACLP_LOGS_STREAM_TESTS" RUN_TRAFFIC_PEAK_TESTS="$RUN_TRAFFIC_PEAK_TESTS" TEST_SUITE="$TEST_SUITE" TEST_ARGS="--junitxml=${report_filename}"
env:
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
RUN_DB_FORK_TESTS: ${{ github.event.inputs.run_db_fork_tests }}
RUN_DB_TESTS: ${{ github.event.inputs.run_db_tests }}
RUN_ACLP_LOGS_STREAM_TESTS: ${{ github.event.inputs.run_aclp_logs_stream_tests }}
RUN_TRAFFIC_PEAK_TESTS: ${{ github.event.inputs.run_traffic_peak_tests }}
TEST_SUITE: ${{ github.event.inputs.test_suite }}

- name: Upload Test Report as Artifact
Expand Down
31 changes: 28 additions & 3 deletions linode_api4/groups/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
AkamaiObjectStorageLogsDestinationDetails,
CustomHTTPSLogsDestinationDetails,
LogsStreamDetails,
TrafficPeakLogsDestinationDetails,
)

__all__ = [
Expand Down Expand Up @@ -455,6 +456,7 @@ def destination_create(
details: Union[
AkamaiObjectStorageLogsDestinationDetails,
CustomHTTPSLogsDestinationDetails,
TrafficPeakLogsDestinationDetails,
],
) -> LogsDestination:
"""
Expand Down Expand Up @@ -495,17 +497,40 @@ def destination_create(
)
)

For a ``traffic_peak`` destination::

new_destination = client.monitor.destination_create(
label="traffic_peak_logs_destination",
type="traffic_peak",
details=TrafficPeakLogsDestinationDetails(
endpoint_url="https://my-site.com",
authentication=TrafficPeakDestinationAuthentication(
details=BasicAuthenticationDetails(
basic_authentication_user="user",
basic_authentication_password="pass",
),
),
data_compression="gzip",
content_type="application/json",
custom_headers=[
CustomHeader(name="header", value="header_value")
],
)
)

API Documentation: https://techdocs.akamai.com/linode-api/reference/post-destination

:param label: The name for this logs destination.
:type label: str
:param type: The type of destination — ``akamai_object_storage`` or ``custom_https``.
:param type: The type of destination — ``akamai_object_storage``, ``custom_https``, or ``traffic_peak``.
:type type: str or LogsDestinationType
:param details: A typed details object matching the destination type.
Use :class:`AkamaiObjectStorageLogsDestinationDetails` for
``akamai_object_storage`` or :class:`CustomHTTPSLogsDestinationDetails`
for ``custom_https``.
:type details: AkamaiObjectStorageLogsDestinationDetails or CustomHTTPSLogsDestinationDetails
for ``custom_https``. Use
:class:`TrafficPeakLogsDestinationDetails` for
``traffic_peak``.
:type details: AkamaiObjectStorageLogsDestinationDetails, CustomHTTPSLogsDestinationDetails, or TrafficPeakLogsDestinationDetails

:returns: The newly created logs destination.
:rtype: LogsDestination
Expand Down
30 changes: 29 additions & 1 deletion linode_api4/objects/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"ContentType",
"CustomHeader",
"CustomHTTPSLogsDestinationDetails",
"TrafficPeakDestinationAuthentication",
"TrafficPeakLogsDestinationDetails",
"DataCompressionType",
"DestinationAuthentication",
"LogsDestinationDetailsBase",
Expand Down Expand Up @@ -158,6 +160,7 @@ class LogsDestinationType(StrEnum):

akamai_object_storage = "akamai_object_storage"
custom_https = "custom_https"
traffic_peak = "traffic_peak"


class AuthenticationType(StrEnum):
Expand Down Expand Up @@ -588,6 +591,15 @@ class DestinationAuthentication(JSONObject):
details: Optional[BasicAuthenticationDetails] = None


@dataclass
class TrafficPeakDestinationAuthentication(JSONObject):
"""
Authentication details for a TrafficPeak destination.
"""

details: Optional[BasicAuthenticationDetails] = None


@dataclass
class CustomHeader(JSONObject):
"""
Expand Down Expand Up @@ -625,7 +637,8 @@ def load_by_type(
Factory method that instantiates the correct details subclass
based on the destination type string.

:param dest_type: The destination type (e.g. "akamai_object_storage", "custom_https").
:param dest_type: The destination type (``akamai_object_storage``,
``custom_https``, or ``traffic_peak``).
:param json_dict: The raw JSON dict for the details block.
:returns: A populated subclass instance, or None if json_dict is empty/None.
"""
Expand All @@ -638,6 +651,8 @@ def load_by_type(
)
elif dest_type == LogsDestinationType.custom_https:
return CustomHTTPSLogsDestinationDetails.from_json(json_dict)
elif dest_type == LogsDestinationType.traffic_peak:
return TrafficPeakLogsDestinationDetails.from_json(json_dict)

return None

Expand All @@ -656,6 +671,19 @@ class CustomHTTPSLogsDestinationDetails(LogsDestinationDetailsBase):
client_certificate_details: Optional[ClientCertificateDetails] = None


@dataclass
class TrafficPeakLogsDestinationDetails(LogsDestinationDetailsBase):
"""
Represents the details block for TrafficPeak LogsDestination type.
"""

endpoint_url: str = ""
authentication: Optional[TrafficPeakDestinationAuthentication] = None
data_compression: Optional[DataCompressionType] = None
content_type: Optional[ContentType] = None
custom_headers: Optional[List[CustomHeader]] = None


@dataclass
class AkamaiObjectStorageLogsDestinationDetails(LogsDestinationDetailsBase):
"""
Expand Down
35 changes: 35 additions & 0 deletions test/fixtures/monitor_streams_4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"id": 4,
"label": "traffic-peak-stream",
"type": "audit_logs",
"status": "active",
"destinations": [
{
"id": 3,
"label": "traffic-peak-destination",
"type": "traffic_peak",
"details": {
"endpoint_url": "https://example.com/",
"authentication": {
"details": {
"basic_authentication_user": "user",
"basic_authentication_password": "password"
}
},
"data_compression": "none",
"content_type": "application/json",
"custom_headers": [
{
"name": "header",
"value": "header_value"
}
]
}
}
],
"created": "2026-09-01T00:00:00",
"updated": "2026-09-01T00:00:00",
"created_by": "tester",
"updated_by": "tester",
"version": 1
}
28 changes: 28 additions & 0 deletions test/fixtures/monitor_streams_destinations_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"id": 3,
"version": 1,
"type": "traffic_peak",
"label": "traffic-peak-destination",
"status": "active",
"created_by": "tester",
"created": "2026-09-01T00:00:00",
"updated_by": "tester",
"updated": "2026-09-01T00:00:00",
"details": {
"endpoint_url": "https://example.com/",
"authentication": {
"details": {
"basic_authentication_user": "user",
"basic_authentication_password": "password"
}
},
"data_compression": "none",
"content_type": "application/json",
"custom_headers": [
{
"name": "header",
"value": "header_value"
}
]
}
}
Loading
Loading