Skip to content

Commit 31791b0

Browse files
committed
feat: [DPS-45125] ACLP Logs - add new TrafficPeak destination type
1 parent 301fad1 commit 31791b0

8 files changed

Lines changed: 423 additions & 46 deletions

File tree

.github/workflows/e2e-test-pr.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ on:
1010
options:
1111
- 'true'
1212
- 'false'
13+
run_traffic_peak_tests:
14+
description: 'Set this parameter to "true" to run ACLP logs TrafficPeak destination related test cases'
15+
required: false
16+
default: 'false'
17+
type: choice
18+
options:
19+
- 'true'
20+
- 'false'
1321
run_db_fork_tests:
1422
description: 'Set this parameter to "true" to run fork database related test cases'
1523
required: false
@@ -112,12 +120,13 @@ jobs:
112120
run: |
113121
timestamp=$(date +'%Y%m%d%H%M')
114122
report_filename="${timestamp}_sdk_test_report.xml"
115-
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"
123+
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"
116124
env:
117125
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
118126
RUN_DB_FORK_TESTS: ${{ github.event.inputs.run_db_fork_tests }}
119127
RUN_DB_TESTS: ${{ github.event.inputs.run_db_tests }}
120128
RUN_ACLP_LOGS_STREAM_TESTS: ${{ github.event.inputs.run_aclp_logs_stream_tests }}
129+
RUN_TRAFFIC_PEAK_TESTS: ${{ github.event.inputs.run_traffic_peak_tests }}
121130
TEST_SUITE: ${{ github.event.inputs.test_suite }}
122131

123132
- name: Upload test results
@@ -218,4 +227,4 @@ jobs:
218227
fi
219228
done
220229
env:
221-
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
230+
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}

.github/workflows/e2e-test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ on:
1111
options:
1212
- 'true'
1313
- 'false'
14+
run_traffic_peak_tests:
15+
description: 'Set this parameter to "true" to run TrafficPeak related test cases'
16+
required: false
17+
default: 'false'
18+
type: choice
19+
options:
20+
- 'true'
21+
- 'false'
1422
run_db_fork_tests:
1523
description: 'Set this parameter to "true" to run fork database related test cases'
1624
required: false
@@ -107,12 +115,13 @@ jobs:
107115
run: |
108116
timestamp=$(date +'%Y%m%d%H%M')
109117
report_filename="${timestamp}_sdk_test_report.xml"
110-
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}"
118+
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}"
111119
env:
112120
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
113121
RUN_DB_FORK_TESTS: ${{ github.event.inputs.run_db_fork_tests }}
114122
RUN_DB_TESTS: ${{ github.event.inputs.run_db_tests }}
115123
RUN_ACLP_LOGS_STREAM_TESTS: ${{ github.event.inputs.run_aclp_logs_stream_tests }}
124+
RUN_TRAFFIC_PEAK_TESTS: ${{ github.event.inputs.run_traffic_peak_tests }}
116125
TEST_SUITE: ${{ github.event.inputs.test_suite }}
117126

118127
- name: Upload Test Report as Artifact

linode_api4/groups/monitor.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
AkamaiObjectStorageLogsDestinationDetails,
2323
CustomHTTPSLogsDestinationDetails,
2424
LogsStreamDetails,
25+
TrafficPeakLogsDestinationDetails,
2526
)
2627

2728
__all__ = [
@@ -455,6 +456,7 @@ def destination_create(
455456
details: Union[
456457
AkamaiObjectStorageLogsDestinationDetails,
457458
CustomHTTPSLogsDestinationDetails,
459+
TrafficPeakLogsDestinationDetails,
458460
],
459461
) -> LogsDestination:
460462
"""
@@ -495,17 +497,40 @@ def destination_create(
495497
)
496498
)
497499
500+
For a ``traffic_peak`` destination::
501+
502+
new_destination = client.monitor.destination_create(
503+
label="traffic_peak_logs_destination",
504+
type="traffic_peak",
505+
details=TrafficPeakLogsDestinationDetails(
506+
endpoint_url="https://my-site.com",
507+
authentication=TrafficPeakDestinationAuthentication(
508+
details=BasicAuthenticationDetails(
509+
basic_authentication_user="user",
510+
basic_authentication_password="pass",
511+
),
512+
),
513+
data_compression="gzip",
514+
content_type="application/json",
515+
custom_headers=[
516+
CustomHeader(name="header", value="header_value")
517+
],
518+
)
519+
)
520+
498521
API Documentation: https://techdocs.akamai.com/linode-api/reference/post-destination
499522
500523
:param label: The name for this logs destination.
501524
:type label: str
502-
:param type: The type of destination — ``akamai_object_storage`` or ``custom_https``.
525+
:param type: The type of destination — ``akamai_object_storage``, ``custom_https``, or ``traffic_peak``.
503526
:type type: str or LogsDestinationType
504527
:param details: A typed details object matching the destination type.
505528
Use :class:`AkamaiObjectStorageLogsDestinationDetails` for
506529
``akamai_object_storage`` or :class:`CustomHTTPSLogsDestinationDetails`
507-
for ``custom_https``.
508-
:type details: AkamaiObjectStorageLogsDestinationDetails or CustomHTTPSLogsDestinationDetails
530+
for ``custom_https``. Use
531+
:class:`TrafficPeakLogsDestinationDetails` for
532+
``traffic_peak``.
533+
:type details: AkamaiObjectStorageLogsDestinationDetails, CustomHTTPSLogsDestinationDetails, or TrafficPeakLogsDestinationDetails
509534
510535
:returns: The newly created logs destination.
511536
:rtype: LogsDestination

linode_api4/objects/monitor.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"ContentType",
2828
"CustomHeader",
2929
"CustomHTTPSLogsDestinationDetails",
30+
"TrafficPeakDestinationAuthentication",
31+
"TrafficPeakLogsDestinationDetails",
3032
"DataCompressionType",
3133
"DestinationAuthentication",
3234
"LogsDestinationDetailsBase",
@@ -158,6 +160,7 @@ class LogsDestinationType(StrEnum):
158160

159161
akamai_object_storage = "akamai_object_storage"
160162
custom_https = "custom_https"
163+
traffic_peak = "traffic_peak"
161164

162165

163166
class AuthenticationType(StrEnum):
@@ -588,6 +591,15 @@ class DestinationAuthentication(JSONObject):
588591
details: Optional[BasicAuthenticationDetails] = None
589592

590593

594+
@dataclass
595+
class TrafficPeakDestinationAuthentication(JSONObject):
596+
"""
597+
Authentication details for a TrafficPeak destination.
598+
"""
599+
600+
details: Optional[BasicAuthenticationDetails] = None
601+
602+
591603
@dataclass
592604
class CustomHeader(JSONObject):
593605
"""
@@ -625,7 +637,8 @@ def load_by_type(
625637
Factory method that instantiates the correct details subclass
626638
based on the destination type string.
627639
628-
:param dest_type: The destination type (e.g. "akamai_object_storage", "custom_https").
640+
:param dest_type: The destination type (``akamai_object_storage``,
641+
``custom_https``, or ``traffic_peak``).
629642
:param json_dict: The raw JSON dict for the details block.
630643
:returns: A populated subclass instance, or None if json_dict is empty/None.
631644
"""
@@ -638,6 +651,8 @@ def load_by_type(
638651
)
639652
elif dest_type == LogsDestinationType.custom_https:
640653
return CustomHTTPSLogsDestinationDetails.from_json(json_dict)
654+
elif dest_type == LogsDestinationType.traffic_peak:
655+
return TrafficPeakLogsDestinationDetails.from_json(json_dict)
641656

642657
return None
643658

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

658673

674+
@dataclass
675+
class TrafficPeakLogsDestinationDetails(LogsDestinationDetailsBase):
676+
"""
677+
Represents the details block for TrafficPeak LogsDestination type.
678+
"""
679+
680+
endpoint_url: str = ""
681+
authentication: Optional[TrafficPeakDestinationAuthentication] = None
682+
data_compression: Optional[DataCompressionType] = None
683+
content_type: Optional[ContentType] = None
684+
custom_headers: Optional[List[CustomHeader]] = None
685+
686+
659687
@dataclass
660688
class AkamaiObjectStorageLogsDestinationDetails(LogsDestinationDetailsBase):
661689
"""
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"id": 4,
3+
"label": "traffic-peak-stream",
4+
"type": "audit_logs",
5+
"status": "active",
6+
"destinations": [
7+
{
8+
"id": 3,
9+
"label": "traffic-peak-destination",
10+
"type": "traffic_peak",
11+
"details": {
12+
"endpoint_url": "https://example.com/",
13+
"authentication": {
14+
"details": {
15+
"basic_authentication_user": "user",
16+
"basic_authentication_password": "password"
17+
}
18+
},
19+
"data_compression": "none",
20+
"content_type": "application/json",
21+
"custom_headers": [
22+
{
23+
"name": "header",
24+
"value": "header_value"
25+
}
26+
]
27+
}
28+
}
29+
],
30+
"created": "2026-09-01T00:00:00",
31+
"updated": "2026-09-01T00:00:00",
32+
"created_by": "tester",
33+
"updated_by": "tester",
34+
"version": 1
35+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"id": 3,
3+
"version": 1,
4+
"type": "traffic_peak",
5+
"label": "traffic-peak-destination",
6+
"status": "active",
7+
"created_by": "tester",
8+
"created": "2026-09-01T00:00:00",
9+
"updated_by": "tester",
10+
"updated": "2026-09-01T00:00:00",
11+
"details": {
12+
"endpoint_url": "https://example.com/",
13+
"authentication": {
14+
"details": {
15+
"basic_authentication_user": "user",
16+
"basic_authentication_password": "password"
17+
}
18+
},
19+
"data_compression": "none",
20+
"content_type": "application/json",
21+
"custom_headers": [
22+
{
23+
"name": "header",
24+
"value": "header_value"
25+
}
26+
]
27+
}
28+
}

0 commit comments

Comments
 (0)