Add Office365 Source Connector#5713
Conversation
Signed-off-by: Savit Aluri <savaluri@amazon.com>
Signed-off-by: Savit Aluri <savaluri@amazon.com>
…bi-toolbag/content/workspace-summary.md Delete wasabi testing files.
…bi-toolbag/.metadata/bootstrap-time.txt Delete Wasabi toolbox used for testing.
feat: Office365 Source Initial Commit
Signed-off-by: Alekhya Parisha <aparisha@amazon.com>
…ce365-updates Rename Atlassian state classes to PaginationCrawler
Alekhya Parisha <aparisha@amazon.com>
Signed-off-by: Alekhya Parisha <aparisha@amazon.com>
Signed-off-by: Aparna Parisha <aparisha@amazon.com>
Signed-off-by: Alekhya Parisha <aparisha@amazon.com>
…-processor Add OCSF transformation processor for Office 365 events
Signed-off-by: Alekhya Parisha <aparisha@amazon.com>
…ce365plugin-updates Add pagination support and fix time window handling
| implementation 'org.projectlombok:lombok:1.18.30' | ||
| annotationProcessor 'org.projectlombok:lombok:1.18.30' | ||
|
|
||
| testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4' |
There was a problem hiding this comment.
Do not specify Jackson versions. They are inherited.
There was a problem hiding this comment.
Removed Jackson versions
|
|
||
| testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4' | ||
| testImplementation project(path: ':data-prepper-test-common') | ||
| testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0' |
There was a problem hiding this comment.
Do not specify Jackson versions. They are inherited.
There was a problem hiding this comment.
Removed Jackson versions
| implementation(libs.spring.web) | ||
| } | ||
|
|
||
| test { |
| * The type Constants. | ||
| */ | ||
| public class Constants { | ||
| public static final String PLUGIN_NAME = "office365"; |
There was a problem hiding this comment.
Microsoft Office 365 is a massive product. The name of this source should reflect what part of Office 365 this is.
I understand this is what this is:
So call it something like office365_management_activity to use the name of this feature within Office 365.
There was a problem hiding this comment.
Renamed the source to ‘microsoft-office365’ as this is approved in blueprint.
| * The type Constants. | ||
| */ | ||
| public class Constants { | ||
| public static final String PLUGIN_NAME = "office365"; |
There was a problem hiding this comment.
Also, you only use this in the Office365Source class. Move it there and make it package protected.
There was a problem hiding this comment.
We need to remain PLUGIN_NAME public as it's used by Office365Source class in a different package for the @DataPrepperPlugin annotation
| package org.opensearch.dataprepper.plugins.source.office365.configuration; | ||
|
|
||
| public class MetadataKeyAttributes { | ||
| public static final String CONTENT_TYPE = "contentType"; |
There was a problem hiding this comment.
Move this into Office365CrawlerClient and make it private.
|
|
||
| @Override | ||
| public void initCredentials() { | ||
| log.info("Initializing credentials..."); |
There was a problem hiding this comment.
| log.info("Initializing credentials..."); | |
| log.info("Initializing credentials."); |
Do not use ellipses in logs. It is confusing to users.
| }, | ||
| authConfig::renewCredentials | ||
| ); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Find expected exceptions and handle differently from unexpected exceptions. Then use the stack trace for the unexpected only.
} catch (SomeClientException e) {
log.error(NOISY, "Received {} response while fetching audit logs for content type {}", e.getSomeWayToGetErrorCodeAndMessage(), contentType);
searchRequestsFailedCounter.increment();
throw new RuntimeException("Failed to fetch audit logs", e);
} catch (Exception e) {
log.error(NOISY, "Error while fetching audit logs for content type {}", contentType, e);
searchRequestsFailedCounter.increment();
throw new RuntimeException("Failed to fetch audit logs", e);
}
Here is some similar code:
It catches parsing exceptions which are expected and handles them without the stack trace.
| * Office 365 Connector main entry point. | ||
| * This class extends CrawlerSourcePlugin to provide Office 365 specific functionality. | ||
| */ | ||
| @DataPrepperPlugin(name = PLUGIN_NAME, |
There was a problem hiding this comment.
Add the @Experimental annotation on this until it is ready to reach a stable state.
| */ | ||
| @Slf4j | ||
| @Named | ||
| public class Office365CrawlerClient implements CrawlerClient<PaginationCrawlerWorkerProgressState> { |
There was a problem hiding this comment.
All of these classes will need unit tests.
There was a problem hiding this comment.
Added unit tests for Office365RestClient. Will be adding unit tests in the next PR
| private static final String SEARCH_REQUESTS_FAILED = "searchRequestsFailed"; | ||
|
|
||
| private final RestTemplate restTemplate = new RestTemplate(); | ||
| private final Office365AuthenticationProvider authConfig; |
There was a problem hiding this comment.
Shouldn't this be the interface? Office365AuthenticationInterface
| public class Office365Source extends CrawlerSourcePlugin { | ||
| private static final Logger LOG = LoggerFactory.getLogger(Office365Source.class); | ||
| private final Office365SourceConfig office365SourceConfig; | ||
| private final Office365AuthenticationProvider office365AuthProvider; |
There was a problem hiding this comment.
Shouldn't this be the interface? Office365AuthenticationInterface
Description
This change implements an Office 365 source plugin for Data Prepper. The plugin interacts with the Office 365 Management API to retrieve audit logs. Key components include:
This PR also includes renaming the existing state objects to be more generic and reuse the same for Atlassian as well as Office365
Note: This is an initial PR for review. Unit tests will be added while awaiting review feedback.
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.