Skip to content

Aclp logs support#963

Open
klipensk wants to merge 18 commits into
linode:mainfrom
akrzyszt:ACLP-LOGS-support
Open

Aclp logs support#963
klipensk wants to merge 18 commits into
linode:mainfrom
akrzyszt:ACLP-LOGS-support

Conversation

@klipensk
Copy link
Copy Markdown

📝 Description

What does this PR do and why is this change necessary?

  1. Adds full SDK support for monitor Logs API. This includes both the destinations and streams. This is a new feature not yet supported in the SDK.
  2. Adds unit tests for newly implemented features.
  3. Adds integration tests for newly implemented features.
  4. Integration tests include safeguards based around the limitations of API.
  • The feature is currently in limited availability, these integration tests are skipped if the feature is not available for the account running tests.
  • Logs Stream functionality is limited to one stream per account. For this reason Logs stream tests will automatically skip if there's a stream existing on the account.
  • Full e2e test for streams require a stream to complete provisioning - based on experience during development this can take up to an hour. Similarly to what's already present for database related tests, an environment variable (run_aclp_logs_stream_tests) needs to be set as true or yes to enable testing the Stream portion of the API.
    github workflow files were updated to include the run_aclp_logs_stream_tests environment variable.

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?

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

How do I run the relevant unit/integration tests?

  1. Follow usual installation/setup steps
  2. Integration tests: make test-int
  3. Unit tests: make test-unit

akrzyszt and others added 17 commits May 6, 2026 10:30
…sue with always serialized storage key and secret - now test logs destination tests will always pass also in recording mode
# Conflicts:
#	test/integration/fixtures/TestLogsDestination_Create_InvalidSecret.yaml
#	test/integration/fixtures/TestLogsDestination_Create_InvalidType.yaml
#	test/integration/fixtures/TestLogsDestination_Delete.yaml
#	test/integration/fixtures/TestLogsDestination_Get.yaml
#	test/integration/fixtures/TestLogsDestination_List.yaml
#	test/integration/fixtures/TestLogsDestination_UpdateAndHistory.yaml
Copilot AI review requested due to automatic review settings May 12, 2026 11:18
@klipensk klipensk requested review from a team as code owners May 12, 2026 11:18
@klipensk klipensk requested review from ckulinsk and jbilskiAkam and removed request for a team May 12, 2026 11:18
@mawilk90 mawilk90 requested review from psnoch-akamai and yec-akamai and removed request for ckulinsk and jbilskiAkam May 12, 2026 11:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds first-class linodego SDK support for the ACLP Monitor Logs API, covering both Logs Destinations (monitor/streams/destinations) and Logs Streams (monitor/streams), along with unit + integration test coverage and CI wiring for optionally running long-running stream tests.

Changes:

  • Introduces new SDK types and client methods for Logs Destinations and Logs Streams, including history endpoints and time parsing.
  • Adds comprehensive unit tests and JSON fixtures for destinations and streams (including LKE audit log stream details).
  • Adds integration tests + go-vcr cassettes for destinations/streams and updates CI to allow opting into stream tests via RUN_ACLP_LOGS_STREAM_TESTS.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
monitor_log_destinations.go Implements Logs Destination models and CRUD/history client methods.
monitor_log_streams.go Implements Logs Stream models and CRUD/history client methods.
test/unit/monitor_logs_test.go Adds unit tests for destinations, streams, and stream type constants.
test/unit/fixtures/monitor_log_destinations_get.json Unit fixture for fetching a destination.
test/unit/fixtures/monitor_log_destinations_list.json Unit fixture for listing destinations (including custom_https).
test/unit/fixtures/monitor_log_destinations_history_list.json Unit fixture for destination history listing.
test/unit/fixtures/monitor_log_destinations_custom_https_get.json Unit fixture for custom_https destination fetch.
test/unit/fixtures/monitor_log_stream.json Unit fixture for fetching a stream (audit_logs).
test/unit/fixtures/monitor_log_streams_list.json Unit fixture for listing streams.
test/unit/fixtures/monitor_log_streams_history.json Unit fixture for stream history listing.
test/unit/fixtures/monitor_log_stream_lke.json Unit fixture for fetching an LKE audit log stream (details block).
test/integration/monitor_logs_test.go Adds integration coverage for destination + stream lifecycle, with long provisioning safeguards.
test/integration/integration_suite_test.go Adjusts go-vcr sanitization behavior to keep credentials usable during recording.
.github/workflows/ci.yml Adds workflow_dispatch input and exports RUN_ACLP_LOGS_STREAM_TESTS to test runs.
test/integration/fixtures/TestLogsDestination_List.yaml VCR cassette for listing destinations.
test/integration/fixtures/TestLogsDestination_Get.yaml VCR cassette for getting a destination.
test/integration/fixtures/TestLogsDestination_Delete.yaml VCR cassette for deleting a destination and cleaning up Object Storage.
test/integration/fixtures/TestLogsDestination_UpdateAndHistory.yaml VCR cassette for updating a destination and validating history.
test/integration/fixtures/TestLogsDestination_Create_InvalidSecret.yaml VCR cassette for invalid destination secret error case.
test/integration/fixtures/TestLogsDestination_Create_InvalidType.yaml VCR cassette for invalid destination type error case.
test/integration/fixtures/TestLogStream_Create_InvalidDestination.yaml VCR cassette for invalid destination stream create error case.
test/integration/fixtures/TestLogStream_Create_EmptyDestinations.yaml VCR cassette for empty destinations stream create error case.
test/integration/fixtures/TestLogStream_Create_TwoDestinations.yaml VCR cassette for multi-destination stream create error case.
test/integration/fixtures/TestLogStream_Delete.yaml VCR cassette for stream delete flow.
test/integration/fixtures/TestLogStream_List.yaml VCR cassette for stream list flow.
test/integration/fixtures/TestLogStream_Get.yaml VCR cassette for stream get flow.
test/integration/fixtures/TestLogStream_Update_LabelAndStatus.yaml VCR cassette for stream label/status update and history validation.
test/integration/fixtures/TestLogStream_Update_Destinations.yaml VCR cassette for stream destination update and history validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 116 to 128
r.AddSaveFilter(func(i *cassette.Interaction) error {
re := regexp.MustCompile("AWSAccessKeyId=[[:alnum:]]{20}")
// Sanitize credentials only when saving to cassette, so that real access/secret
// keys are available to test code during recording (e.g. for creating a
// LogsDestination that requires valid object-storage credentials).
re := regexp.MustCompile(`"access_key": "[[:alnum:]]*"`)
i.Response.Body = re.ReplaceAllString(i.Response.Body, `"access_key": "[SANITIZED]"`)
re = regexp.MustCompile(`"secret_key": "[[:alnum:]]*"`)
i.Response.Body = re.ReplaceAllString(i.Response.Body, `"secret_key": "[SANITIZED]"`)

re = regexp.MustCompile("AWSAccessKeyId=[[:alnum:]]{20}")
i.Response.Body = re.ReplaceAllString(i.Response.Body, "AWSAccessKeyID=SANITIZED")
i.Request.URL = re.ReplaceAllString(i.Request.URL, "AWSAccessKeyID=SANITIZED")
return nil
Comment on lines +532 to +534
- request:
body: '{"label":"go-test-logs-monitoring-1778509553204727000","type":"akamai_object_storage","details":{"access_key_id":"8I1CNGBK5HMRA19RGGY6","access_key_secret":"zHkpzPuAJFyIQjZgRdJz39EW8NVRwiDPsBCMd3Uw","bucket_name":"go-test-logs-monitoring-1778509545074390000","host":"go-test-logs-monitoring-1778509545074390000.gb-lon-1.linodeobjects.com"}}'
form: {}
Comment on lines +87 to +94
res, err := http.DefaultClient.Do(req)
if err != nil {
t.Errorf("failed to delete object: %s", err)
continue
}
if res.StatusCode != 204 {
t.Errorf("expected status code to be 204; got %d", res.StatusCode)
}
Comment on lines +116 to +130
dest, err := client.CreateLogsDestination(context.Background(), linodego.LogsDestinationCreateOptions{
Label: testLabel(),
Type: linodego.LogsDestinationTypeAkamaiObjectStorage,
Details: linodego.LogsDestinationDetailsCreateOptions{
AccessKeyID: storageKey.AccessKey,
AccessKeySecret: storageKey.SecretKey,
BucketName: bucket.Label,
Host: bucket.Hostname,
},
})
if err != nil {
storageTeardown()
fixtureTeardown()
t.Fatalf("Error creating logs destination, got error %v", err)
}
…event input run_aclp_logs_stream_tests to integration tests pr yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants